Modernize website and automate Pages deployment (#114) #3
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: Website | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'website/**' | |
| - '.github/workflows/website.yml' | |
| pull_request: | |
| paths: | |
| - 'website/**' | |
| - '.github/workflows/website.yml' | |
| # Allows deploying the current main manually from the Actions tab. | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| # Superseded builds of the same branch/PR are pointless; cancel them. Keyed | |
| # per ref so PR builds never queue behind each other or behind a deployment. | |
| concurrency: | |
| group: website-build-${{ github.ref }} | |
| cancel-in-progress: true | |
| defaults: | |
| run: | |
| working-directory: website | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| # Docusaurus 3.10 segfaults on Node 24; 22 is the supported LTS. | |
| node-version-file: website/.nvmrc | |
| cache: npm | |
| cache-dependency-path: website/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build website | |
| run: npm run build | |
| - name: Upload Pages artifact | |
| if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: website/build | |
| deploy: | |
| needs: build | |
| if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
| runs-on: ubuntu-latest | |
| # Only one concurrent deployment; don't cancel an in-progress one. | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |