diff options
| author | 2023-12-21 15:26:03 -0800 | |
|---|---|---|
| committer | 2024-01-02 13:16:54 +0100 | |
| commit | 7af04ee30d40e02e47bef4229bd823b541a0a352 (patch) | |
| tree | 0f45f6b05e76fb5aa6a2bf037543a7b8965bd98b /.github/workflows | |
| parent | Remove the default allocator from `ParseOptions` (diff) | |
| download | zig-clap-7af04ee30d40e02e47bef4229bd823b541a0a352.tar.gz zig-clap-7af04ee30d40e02e47bef4229bd823b541a0a352.tar.xz zig-clap-7af04ee30d40e02e47bef4229bd823b541a0a352.zip | |
Add autodoc website
This adds a `zig build docs` step that builds the documentation website
and writes it to zig-out/docs.
It further includes a GitHub Workflow that publishes this website
to GitHub Pages. The GitHub Workflow is divided into two jobs:
- build: builds the documentation and uploads it
- publish: downloads the documentation and publishes it
These are separate jobs to minimize permissions available
to the build job.
This workflow runs on two events:
- after every push to master
- `workflow_dispatch`: this allows manually running the workflow
from its *Actions* page if something went wrong
---
**Important pre-merge steps:**
If this PR is accepted, the following steps should be taken
before merging the PR:
1. Go to **Settings** for the repository
2. Select **Pages** on the left under *Code and automation*
3. Under *Build and deployment* set **Source** to **GitHub Actions**
4. Merge the PR.
If the steps are missed, the PR will merge just fine,
but the docs job will fail immediately on merge.
This can be remedied by following steps 1-3 above,
and either adding a new commit on master,
or manually firing the workflow from the Actions > API Reference page.
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/docs.yml | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..defe4e2 --- /dev/null +++ b/.github/workflows/docs.yml | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | name: API Reference | ||
| 2 | |||
| 3 | on: | ||
| 4 | push: | ||
| 5 | branches: [master] | ||
| 6 | |||
| 7 | # Allow manually starting the workflow. | ||
| 8 | workflow_dispatch: | ||
| 9 | |||
| 10 | # If two concurrent runs are started, | ||
| 11 | # prefer the latest one. | ||
| 12 | concurrency: | ||
| 13 | group: "pages" | ||
| 14 | cancel-in-progress: true | ||
| 15 | |||
| 16 | jobs: | ||
| 17 | |||
| 18 | build: | ||
| 19 | name: Build website | ||
| 20 | runs-on: ubuntu-latest | ||
| 21 | steps: | ||
| 22 | - uses: actions/checkout@v4 | ||
| 23 | - uses: goto-bus-stop/setup-zig@v2.0.1 | ||
| 24 | with: | ||
| 25 | version: master | ||
| 26 | - name: Build | ||
| 27 | run: zig build docs | ||
| 28 | - name: Upload | ||
| 29 | uses: actions/upload-pages-artifact@v2 | ||
| 30 | with: | ||
| 31 | path: "zig-out/docs/" | ||
| 32 | |||
| 33 | publish: | ||
| 34 | name: Publish website | ||
| 35 | runs-on: ubuntu-latest | ||
| 36 | needs: build # wait for build to finish | ||
| 37 | permissions: | ||
| 38 | # Request sufficient permissions to publish the website. | ||
| 39 | pages: write | ||
| 40 | id-token: write | ||
| 41 | steps: | ||
| 42 | - name: Deploy to GitHub Pages | ||
| 43 | id: deployment | ||
| 44 | uses: actions/deploy-pages@v3 | ||
| 45 | environment: | ||
| 46 | name: github-pages | ||
| 47 | url: ${{ steps.deployment.outputs.page_url }} | ||