Deploy to GitHub Pages #51
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 to GitHub Pages | |
| on: | |
| # Manual trigger only | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Allow only one concurrent deployment | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build website | |
| run: npm run build | |
| - name: Verify IndexNow payload generation | |
| run: npm run test:indexnow && npm run indexnow:dry-run -- --sitemap build/sitemap.xml | |
| - name: Upload sitemap for IndexNow submission | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: indexnow-sitemap | |
| path: ./build/sitemap.xml | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./build | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| submit-indexnow: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build | |
| - deploy | |
| if: ${{ needs.deploy.result == 'success' }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| - name: Download sitemap artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: indexnow-sitemap | |
| path: ./build | |
| - name: Submit deployed URLs to IndexNow | |
| run: npm run indexnow:submit -- --sitemap build/sitemap.xml |