mirror of
https://github.com/astral-sh/ruff
synced 2026-01-20 21:10:48 -05:00
Related https://github.com/astral-sh/ruff/issues/7276 Our docs publishing action does not allow targetting a specific commit when run manually which means we cannot update the documentation to anything but the latest commit on `main`. This change allows a ref to be provided. --------- Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
55 lines
2.0 KiB
YAML
55 lines
2.0 KiB
YAML
name: mkdocs
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
ref:
|
|
description: "The commit SHA, tag, or branch to publish. Uses the default branch if not specified."
|
|
default: ""
|
|
type: string
|
|
release:
|
|
types: [published]
|
|
|
|
jobs:
|
|
mkdocs:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
CF_API_TOKEN_EXISTS: ${{ secrets.CF_API_TOKEN != '' }}
|
|
MKDOCS_INSIDERS_SSH_KEY_EXISTS: ${{ secrets.MKDOCS_INSIDERS_SSH_KEY != '' }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ inputs.ref }}
|
|
- uses: actions/setup-python@v4
|
|
- name: "Add SSH key"
|
|
if: ${{ env.MKDOCS_INSIDERS_SSH_KEY_EXISTS == 'true' }}
|
|
uses: webfactory/ssh-agent@v0.8.0
|
|
with:
|
|
ssh-private-key: ${{ secrets.MKDOCS_INSIDERS_SSH_KEY }}
|
|
- name: "Install Rust toolchain"
|
|
run: rustup show
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: "Install Insiders dependencies"
|
|
if: ${{ env.MKDOCS_INSIDERS_SSH_KEY_EXISTS == 'true' }}
|
|
run: pip install -r docs/requirements-insiders.txt
|
|
- name: "Install dependencies"
|
|
if: ${{ env.MKDOCS_INSIDERS_SSH_KEY_EXISTS != 'true' }}
|
|
run: pip install -r docs/requirements.txt
|
|
- name: "Copy README File"
|
|
run: |
|
|
python scripts/transform_readme.py --target mkdocs
|
|
python scripts/generate_mkdocs.py
|
|
- name: "Build Insiders docs"
|
|
if: ${{ env.MKDOCS_INSIDERS_SSH_KEY_EXISTS == 'true' }}
|
|
run: mkdocs build --strict -f mkdocs.insiders.yml
|
|
- name: "Build docs"
|
|
if: ${{ env.MKDOCS_INSIDERS_SSH_KEY_EXISTS != 'true' }}
|
|
run: mkdocs build --strict -f mkdocs.generated.yml
|
|
- name: "Deploy to Cloudflare Pages"
|
|
if: ${{ env.CF_API_TOKEN_EXISTS == 'true' }}
|
|
uses: cloudflare/wrangler-action@v3.1.1
|
|
with:
|
|
apiToken: ${{ secrets.CF_API_TOKEN }}
|
|
accountId: ${{ secrets.CF_ACCOUNT_ID }}
|
|
command: pages deploy site --project-name=ruff-docs --branch ${GITHUB_HEAD_REF} --commit-hash ${GITHUB_SHA}
|