Skip to content

Merge pull request #592 from OpShin/dependabot/github_actions/dev/act… #190

Merge pull request #592 from OpShin/dependabot/github_actions/dev/act…

Merge pull request #592 from OpShin/dependabot/github_actions/dev/act… #190

Workflow file for this run

name: website
# build the documentation whenever there are new commits on dev, or when triggered manually
on:
push:
branches:
- dev
workflow_dispatch:
inputs:
ref:
description: 'Git reference (branch/tag/SHA) to build documentation from'
required: false
default: dev
repository_dispatch:
types: [trigger_website_build]
# security: restrict permissions for CI jobs.
permissions:
contents: read
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
ref: ${{ steps.resolve.outputs.ref }}
steps:
- name: Resolve ref
id: resolve
shell: bash
env:
EVENT_NAME: ${{ github.event_name }}
INPUT_REF: ${{ github.event.inputs.ref }}
PAYLOAD_REF: ${{ github.event.client_payload.ref }}
GITHUB_SHA: ${{ github.sha }}
run: |
set -euo pipefail
if [[ "${EVENT_NAME}" == "push" ]]; then
echo "ref=${GITHUB_SHA}" >> "${GITHUB_OUTPUT}"
elif [[ "${EVENT_NAME}" == "workflow_dispatch" ]]; then
if [[ -z "${INPUT_REF}" ]]; then
echo "Manual runs require the ref input." >&2
exit 1
fi
echo "ref=${INPUT_REF}" >> "${GITHUB_OUTPUT}"
elif [[ "${EVENT_NAME}" == "repository_dispatch" ]]; then
if [[ -z "${PAYLOAD_REF}" ]]; then
echo "Repository dispatch events must include client_payload.ref." >&2
exit 1
fi
echo "ref=${PAYLOAD_REF}" >> "${GITHUB_OUTPUT}"
else
echo "Unsupported event ${EVENT_NAME}" >&2
exit 1
fi
get-python-versions:
needs: prepare
runs-on: ubuntu-latest
outputs:
primary-version: ${{ steps.get-versions.outputs.primary-version }}
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
ref: ${{ needs.prepare.outputs.ref }}
- name: Get Python versions
id: get-versions
uses: ./.github/actions/get-python-versions
# Build the documentation and upload the static HTML files as an artifact.
build:
needs: [prepare, get-python-versions]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
ref: ${{ needs.prepare.outputs.ref }}
- uses: actions/setup-python@v6
with:
python-version: ${{ needs.get-python-versions.outputs.primary-version }}
- name: Install uv
uses: astral-sh/setup-uv@v7
- run: uv sync
- run: bash build_docs.sh
- uses: actions/upload-pages-artifact@v4
with:
path: docs/
# Deploy the artifact to GitHub pages.
# This is a separate job so that only actions/deploy-pages has the necessary permissions.
deploy:
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4