This repository has been archived by the owner on Jan 14, 2025. It is now read-only.
build: publish drafts to GitHub Pages #1
This file contains 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: Continuous Integration | |
# Trigger this workflow manually, by pushing commits to any branch, or | |
# by filing a pull request. | |
on: | |
workflow_dispatch: | |
push: | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
steps: | |
# Check out the repository as of this commit and cache the | |
# working directory for use in other jobs or for re-use if | |
# re-running the workflow (e.g., something outside of GitHub | |
# Actions broke). | |
- id: cache-workdir | |
uses: actions/cache@v3 | |
with: | |
key: workdir-${{ github.sha }} | |
path: . | |
# Python Semantic Release needs the history of all branches/tags | |
# to calculate the next version number and build the change log. | |
- if: steps.cache-workdir.outputs.cache-hit != 'true' | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
lint: | |
needs: setup | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/cache/restore@v3 | |
with: | |
key: workdir-${{ github.sha }} | |
path: . | |
# Install linter dependencies here; for example: | |
# - uses: opentofu/[email protected] | |
# - uses: terraform-linters/setup-tflint@v4 | |
# Double-check code syntax/style. This ought to happen in a | |
# pre-commit hook, but not everyone may have that installed. | |
- uses: pre-commit/[email protected] | |
docs: | |
needs: lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/cache/restore@v4 | |
with: | |
key: workdir-${{ github.sha }} | |
path: . | |
- uses: actions/setup-python@v5 | |
with: | |
cache: pip | |
# Install doc builder dependencies here. | |
- run: pip install matplotlib myst-parser[linkify,rtd] pystemmer sphinx-intl | |
# Generate hypertext and print media, once per target language. | |
- run: sphinx-build -b html docs build/html/en -D language=en | |
# The document generation process could run malicious | |
# third-party code in a supply chain attack, so this job doesn't | |
# run with elevated privileges. Instead, it uploads | |
# documentation into an immutable archive (a GitHub Actions | |
# Artifact) that a subsequent, privileged job will publish. | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: doc-artifacts | |
path: build/* | |
if-no-files-found: error | |
overwrite: true | |
gh-pages: | |
needs: | |
- docs | |
runs-on: ubuntu-latest | |
permissions: | |
# Allow this job to push web content to the gh-pages branch. | |
contents: write | |
steps: | |
# Publish the web content using GitHub Pages. | |
- uses: actions/download-artifact@v4 | |
with: | |
name: doc-artifacts | |
path: build/ | |
merge-multiple: true | |
- uses: peaceiris/actions-gh-pages@v4 | |
with: | |
force_orphan: true | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: build/html/en |