diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bc058a610..8570da5ca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: windows-latest permissions: contents: read @@ -39,24 +39,26 @@ jobs: working-directory: ./igniteui-angular-examples/browser - name: Apply very special configuration - shell: bash + shell: pwsh run: | - echo "Current directory: $(pwd)" - sed -i 's/build --configuration production/build --configuration production --base-href=\/angular-demos-dv\//g' package.json + Write-Output $pwd + ((Get-Content -Path package.json -Raw) -replace 'build --configuration production','build --configuration production --base-href=/angular-demos-dv/') | Set-Content -Path package.json working-directory: ./igniteui-angular-examples/browser - name: Build project + shell: pwsh run: | - if [ "${{ github.event.inputs.isVerbose }}" == "true" ]; then + if ("${{ github.event.inputs.isVerbose }}" -eq "true") { npm run build --verbose - else + } else { npm run build - fi + } working-directory: ./igniteui-angular-examples/browser - name: Copy web.config to dist + shell: pwsh run: | - cp web.config dist/browser/ + Copy-Item web.config dist/browser/ working-directory: ./igniteui-angular-examples/browser - name: Upload build artifacts diff --git a/browser/scripts/browser.js b/browser/scripts/browser.js index d9a3e6371..96d3c0301 100644 --- a/browser/scripts/browser.js +++ b/browser/scripts/browser.js @@ -29,12 +29,17 @@ const repoName = "igniteui-angular-examples"; const sampleRoot = '../samples/'; // /samples/ const sampleOutput = './src/samples/'; // /browser/src/samples/ -// C:\REPOS\GitInternalDocs\igniteui-angular-examples\samples\charts\data-chart\axis-sharing -// returns ../samples/charts/data-chart/axis-sharing +// C:\REPOS\...\samples\charts\data-chart\axis-sharing +// /home/runner/work/.../samples/charts/data-chart/axis-sharing +// returns ../samples/charts/data-chart/axis-sharing function getSamplePath(dirPath) { - var ret = dirPath.split(repoName)[1]; - ret = ".." + ret.split("\\").join("/"); - return ret; + const normalized = path.normalize(dirPath); + const segments = normalized.split(path.sep); + const samplesIdx = segments.lastIndexOf('samples'); + if (samplesIdx < 0) { + throw new Error("Cannot locate 'samples' folder in path: " + dirPath); + } + return ['..'].concat(segments.slice(samplesIdx)).join('/'); } // C:\REPOS\GitInternalDocs\igniteui-angular-examples\samples\charts\data-chart\axis-sharing @@ -1552,4 +1557,4 @@ exports.updateCodeSandbox = function updateCodeSandbox(cb) { cb(); }); -} \ No newline at end of file +}