Merge pull request #34 from IgniteUI/vnext #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy GitHub Pages | |
| on: | |
| push: | |
| branches: [ master ] | |
| workflow_dispatch: {} | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pages: write | |
| id-token: write | |
| actions: read | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| strategy: | |
| matrix: | |
| node-version: [22.x] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v2 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| # cache: 'npm' # enable after committing lock file from first install | |
| - run: npm i # replace with 'npm ci' after committing lock file from first install | |
| - name: Set environment variable for basename | |
| run: echo "VITE_BASENAME=/${{ github.event.repository.name }}" >> $GITHUB_ENV | |
| - run: npm run build -- --base=/${{ github.event.repository.name }}/ | |
| - name: Update Resource Paths | |
| run: | | |
| find ./dist/assets -type f -name "*.js" -exec sed -i 's|src/assets|${{ github.event.repository.name }}/assets|g' {} +; | |
| find ./dist/assets -type f -name "*.js" -exec sed -i 's|/static-data/|/${{ github.event.repository.name }}/static-data/|g' {} + | |
| - name: Copy Resources to dist | |
| run: mkdir -p ./dist/assets && cp -R ./src/assets/* ./dist/assets/ | |
| - name: SPA routing handling | |
| run: cp ./dist/index.html ./dist/404.html | |
| - name: Upload build artifact to GitHub Pages | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./dist | |
| - name: Deploy to GitHub Pages | |
| uses: actions/deploy-pages@v4 |