Files
2026-07-13 13:05:14 +08:00

247 lines
7.7 KiB
YAML

name: "Reusable Deploy Docs"
on:
workflow_call:
inputs:
CONCURRENCY:
required: true
type: string
JS_DOCS_VERSION_NAME:
required: true
type: string
PY_DOCS_VERSION_NAME:
required: true
type: string
CPP_DOCS_VERSION_NAME:
required: true
type: string
MARKDOWN_DOCS_VERSION_NAME:
required: true
type: string
description: |
Version label to upload markdown docs/examples under on GCS
(`gs://rerun-docs/prose/{label}/`). Use `dev` for non-final
releases / pushes to main, the semver string for final
releases, or `pr-{N}` for PR previews.
RELEASE_VERSION:
required: false
type: string
RELEASE_COMMIT:
required: false
type: string
UPDATE_LATEST:
required: false
type: boolean
default: false
concurrency:
group: ${{ inputs.CONCURRENCY }}-deploy-docs
cancel-in-progress: true
defaults:
run:
shell: bash --noprofile --norc -euo pipefail {0}
permissions:
contents: "write"
id-token: "write"
env:
PYTHON_VERSION: "3.10"
RUSTFLAGS: --deny warnings
RUSTDOCFLAGS: --deny warnings
jobs:
# ---------------------------------------------------------------------------
py-deploy-docs:
name: Python
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.RELEASE_COMMIT || (github.event_name == 'pull_request' && github.event.pull_request.head.ref || '') }}
- uses: prefix-dev/setup-pixi@v0.10.0
with:
pixi-version: v0.71.3
- id: "auth"
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v2"
with:
version: ">= 363.0.0"
- name: Build docs
run: pixi run uv run --group docs mkdocs build -f rerun_py/mkdocs.yml -d site
- name: "Upload Python Docs (version)"
uses: google-github-actions/upload-cloud-storage@v3
with:
path: "rerun_py/site"
destination: "rerun-docs/docs/python/${{ inputs.PY_DOCS_VERSION_NAME }}"
process_gcloudignore: false
parent: false
resumable: false
- name: "Update URL rewrite rules for stable"
if: ${{ inputs.UPDATE_LATEST }}
run: |
pixi run uv run --group dev scripts/update_docs_url_rewrite.py --version ${{ inputs.PY_DOCS_VERSION_NAME }} --language python
- name: "Update versions.json"
if: ${{ inputs.UPDATE_LATEST }}
run: |
VERSION=${{ inputs.PY_DOCS_VERSION_NAME }}
echo "download existing"
gsutil cp gs://rerun-docs/docs/python/versions.json ./
cat versions.json
echo "remove `stable` alias"
jq -c 'map(.aliases |= map(select(. != "stable")))' versions.json > versions.json.new
cat versions.json.new
echo "prepend new version with `stable` alias"
jq -c --arg v "$VERSION" '[{ version: $v, title: $v, aliases: ["stable"] }] + .' versions.json.new > versions.json
cat versions.json
echo "overwrite the file on gcs"
gsutil cp ./versions.json gs://rerun-docs/docs/python/
# ---------------------------------------------------------------------------
cpp-deploy-docs:
name: Cpp
runs-on: ubuntu-latest
steps:
- name: Show context
run: |
echo "GITHUB_CONTEXT": $GITHUB_CONTEXT
echo "JOB_CONTEXT": $JOB_CONTEXT
echo "INPUTS_CONTEXT": $INPUTS_CONTEXT
echo "ENV_CONTEXT": $ENV_CONTEXT
env:
ENV_CONTEXT: ${{ toJson(env) }}
GITHUB_CONTEXT: ${{ toJson(github) }}
JOB_CONTEXT: ${{ toJson(job) }}
INPUTS_CONTEXT: ${{ toJson(inputs) }}
- uses: actions/checkout@v4
with:
ref: ${{ inputs.RELEASE_COMMIT || (github.event_name == 'pull_request' && github.event.pull_request.head.ref || '') }}
- id: "auth"
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
- uses: prefix-dev/setup-pixi@v0.10.0
with:
pixi-version: v0.71.3
- name: Doxygen C++ docs
run: pixi run -e cpp cpp-docs
- name: "Upload C++ Docs (version)"
uses: google-github-actions/upload-cloud-storage@v3
with:
path: "rerun_cpp/docs/html"
destination: "rerun-docs/docs/cpp/${{ inputs.RELEASE_VERSION }}"
process_gcloudignore: false
parent: false
resumable: false
- name: "Upload C++ Docs (named)"
if: ${{ inputs.UPDATE_LATEST }}
uses: google-github-actions/upload-cloud-storage@v3
with:
path: "rerun_cpp/docs/html"
destination: "rerun-docs/docs/cpp/${{ inputs.CPP_DOCS_VERSION_NAME }}"
process_gcloudignore: false
parent: false
resumable: false
js-deploy-docs:
name: JS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.RELEASE_COMMIT || (github.event_name == 'pull_request' && github.event.pull_request.head.ref || '') }}
- uses: prefix-dev/setup-pixi@v0.10.0
with:
pixi-version: v0.71.3
- id: "auth"
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v2"
with:
version: ">= 363.0.0"
- name: Build docs
run: pixi run js-docs
- name: "Upload (version)"
uses: google-github-actions/upload-cloud-storage@v3
with:
path: "rerun_js/docs"
destination: "rerun-docs/docs/js/${{ inputs.JS_DOCS_VERSION_NAME }}"
process_gcloudignore: false
parent: false
resumable: false
- name: "Update URL rewrite rules for stable"
if: ${{ inputs.UPDATE_LATEST }}
run: |
pixi run uv run --group dev scripts/update_docs_url_rewrite.py --version ${{ inputs.JS_DOCS_VERSION_NAME }} --language js
# ---------------------------------------------------------------------------
md-deploy-docs:
name: Markdown
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.RELEASE_COMMIT || (github.event_name == 'pull_request' && github.event.pull_request.head.ref || '') }}
- uses: prefix-dev/setup-pixi@v0.10.0
with:
pixi-version: v0.71.3
- id: "auth"
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
- name: "Upload markdown docs & examples to GCS"
env:
ISR_BYPASS_TOKEN: ${{ secrets.ISR_BYPASS_TOKEN }}
VERSION_LABEL: ${{ inputs.MARKDOWN_DOCS_VERSION_NAME }}
MARK_LATEST: ${{ inputs.UPDATE_LATEST }}
RERUN_COMMIT: ${{ inputs.RELEASE_COMMIT }}
run: |
ARGS=(upload --version "$VERSION_LABEL" --purge-token "$ISR_BYPASS_TOKEN")
if [ "$MARK_LATEST" = "true" ]; then
ARGS+=(--mark-latest)
fi
if [ -n "$RERUN_COMMIT" ]; then
ARGS+=(--rerun-commit "$RERUN_COMMIT")
fi
pixi run uv run scripts/ci/upload_docs.py "${ARGS[@]}"