Add GitHub Pages publishing workflow #1
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
| # Copyright 2025 The zb Authors | |
| # SPDX-License-Identifier: MIT | |
| name: Publish | |
| on: | |
| push: | |
| pull_request: | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Nix | |
| uses: cachix/install-nix-action@v31 | |
| - name: Sphinx | |
| run: |- | |
| nix develop \ | |
| --set-env-var SOURCE_DATE_EPOCH "$(git show --no-patch --format='%ct' HEAD)" \ | |
| --command make html | |
| - name: Save Output | |
| id: upload | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| name: github-pages | |
| path: _build/html | |
| outputs: | |
| artifact-name: github-pages | |
| artifact-id: ${{steps.upload.outputs.artifact_id}} | |
| pages: | |
| name: GitHub Pages | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deploy.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deploy | |
| uses: actions/deploy-pages@v4 | |
| with: | |
| artifact_name: ${{needs.build.outputs.artifact-name}} |