|
| 1 | +name: Deploy to GitHub Pages |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + pages: write |
| 12 | + id-token: write |
| 13 | + |
| 14 | +# Allow only one concurrent deployment, skipping runs queued between an |
| 15 | +# in-progress run and the latest queued one. Cancelling in-progress runs |
| 16 | +# is not desired here to avoid a broken/partial Pages deployment. |
| 17 | +concurrency: |
| 18 | + group: pages |
| 19 | + cancel-in-progress: false |
| 20 | + |
| 21 | +jobs: |
| 22 | + build: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + steps: |
| 25 | + - name: Checkout |
| 26 | + uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - name: Setup Node.js |
| 29 | + uses: actions/setup-node@v4 |
| 30 | + with: |
| 31 | + node-version: '24' |
| 32 | + cache: npm |
| 33 | + |
| 34 | + - name: Install dependencies |
| 35 | + run: npm ci |
| 36 | + |
| 37 | + - name: Build (production) |
| 38 | + run: npm run build -- --configuration production |
| 39 | + |
| 40 | + # GitHub Pages ignores files/folders starting with "_" unless this |
| 41 | + # marker is present, and it also skips its Jekyll build step. |
| 42 | + - name: Disable Jekyll processing |
| 43 | + run: touch dist/java-amazonas/browser/.nojekyll |
| 44 | + |
| 45 | + # The app uses the Angular Router with PathLocationStrategy (HTML5 |
| 46 | + # push-state). GitHub Pages has no server-side rewrites, so a direct |
| 47 | + # load/refresh on any non-root URL returns GitHub's own 404 page. |
| 48 | + # Serving a copy of index.html as 404.html lets GitHub Pages hand the |
| 49 | + # request back to the Angular app, which then renders the app's own |
| 50 | + # NotFoundComponent (wildcard route) for unknown paths. |
| 51 | + - name: Add SPA fallback (404.html) |
| 52 | + run: cp dist/java-amazonas/browser/index.html dist/java-amazonas/browser/404.html |
| 53 | + |
| 54 | + - name: Setup Pages |
| 55 | + uses: actions/configure-pages@v5 |
| 56 | + |
| 57 | + - name: Upload artifact |
| 58 | + uses: actions/upload-pages-artifact@v3 |
| 59 | + with: |
| 60 | + path: dist/java-amazonas/browser |
| 61 | + |
| 62 | + deploy: |
| 63 | + needs: build |
| 64 | + runs-on: ubuntu-latest |
| 65 | + environment: |
| 66 | + name: github-pages |
| 67 | + url: ${{ steps.deployment.outputs.page_url }} |
| 68 | + steps: |
| 69 | + - name: Deploy to GitHub Pages |
| 70 | + id: deployment |
| 71 | + uses: actions/deploy-pages@v4 |
0 commit comments