Web #288
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
| # Zola docs site (replaces the old oranda + cargo-dist pipeline). | |
| # | |
| # Build paths: | |
| # - On every PR -> nix build .#site (verifies the site compiles) | |
| # - On push to main -> nix build + deploy gh-pages | |
| # - On Release done -> fetch the latest release manifest into | |
| # docs-site/data/releases.json, then deploy | |
| # | |
| # The site derivation lives at nix/site.nix. It pulls font files from | |
| # the fontsource CDN with pinned hashes, injects the config-reference | |
| # markdown from `nix build .#docs`, and runs `zola build`. | |
| name: Web | |
| on: | |
| pull_request: | |
| paths: | |
| - "docs-site/**" | |
| - "docs/**" | |
| - "nix/site.nix" | |
| - "nix/gen-docs.nix" | |
| - "scripts/fetch-releases.sh" | |
| - ".github/workflows/web.yml" | |
| push: | |
| branches: [main] | |
| paths: | |
| - "docs-site/**" | |
| - "docs/**" | |
| - "nix/site.nix" | |
| - "nix/gen-docs.nix" | |
| - "scripts/fetch-releases.sh" | |
| - ".github/workflows/web.yml" | |
| workflow_run: | |
| workflows: ["Release"] | |
| types: [completed] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: web-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| name: Build & deploy site | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Nix | |
| uses: DeterminateSystems/nix-installer-action@main | |
| with: | |
| extra-conf: | | |
| experimental-features = nix-command flakes | |
| accept-flake-config = true | |
| - name: Attic cache | |
| uses: ryanccn/attic-action@v0 | |
| with: | |
| endpoint: https://cache.sergioribera.rs | |
| cache: main | |
| token: ${{ secrets.ATTIC_TOKEN }} | |
| # Pull the latest GitHub release per binary into the site's data tree | |
| # so the install page tabulates real artifacts. Skipped on PRs from | |
| # forks (no token) and tolerated when no release exists yet. | |
| - name: Fetch latest release manifest | |
| if: github.event_name != 'pull_request' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| REPO: ${{ github.repository }} | |
| run: scripts/fetch-releases.sh docs-site/data/releases.json | |
| - name: Build site | |
| run: nix build .#site -L --print-out-paths | |
| - name: Stage public/ | |
| run: | | |
| rm -rf public | |
| mkdir -p public | |
| cp -L --no-preserve=mode,ownership -r result/* public/ | |
| touch public/.nojekyll | |
| - name: Configure GitHub Pages | |
| if: github.event_name != 'pull_request' | |
| uses: actions/configure-pages@v5 | |
| - name: Upload Pages artifact | |
| if: github.event_name != 'pull_request' | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: public | |
| deploy: | |
| name: Deploy to GitHub Pages | |
| needs: build | |
| if: github.event_name != 'pull_request' | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.pages.outputs.page_url }} | |
| steps: | |
| - name: Deploy | |
| id: pages | |
| uses: actions/deploy-pages@v4 |