try rc build

This commit is contained in:
2026-02-04 18:23:18 -06:00
parent 45da756495
commit 96f6c8c0b7
2 changed files with 105 additions and 1 deletions

View File

@@ -2,6 +2,8 @@ name: CI - Docs build check
on: on:
pull_request: pull_request:
branches-ignore:
- gh-pages
push: push:
workflow_dispatch: workflow_dispatch:
@@ -37,6 +39,6 @@ jobs:
- name: MkDocs build (strict default) - name: MkDocs build (strict default)
run: | run: |
set -euo pipefail set -euo pipefail
# Default strict on if unset # Default not strict on if unset
export MKDOCS_STRICT="${MKDOCS_STRICT:-true}" export MKDOCS_STRICT="${MKDOCS_STRICT:-true}"
tools/build.sh --config mkdocs/mkdocs.yml tools/build.sh --config mkdocs/mkdocs.yml

102
.github/workflows/deploy-rc-pages.yml vendored Normal file
View File

@@ -0,0 +1,102 @@
name: Deploy RC preview to GitHub Pages
on:
push:
tags: ["v*"]
workflow_dispatch:
permissions:
contents: write
jobs:
deploy-rc-pages:
runs-on: ubuntu-latest
steps:
- name: Guard - only run for RC tags; deploy only on GitHub
run: |
set -euo pipefail
TAG="${GITHUB_REF_NAME:-}"
CI_PROVIDER="${CI_PROVIDER:-github}"
ENABLE_DEPLOY="${ENABLE_DEPLOY:-false}"
if [[ -z "$TAG" ]] || [[ "$TAG" != v* ]] || [[ "$TAG" != *"-rc"* ]]; then
echo "Not an RC tag ($TAG); skipping."
exit 0
fi
if [[ "${ENABLE_DEPLOY}" != "true" ]]; then
echo "Skipping deploy: ENABLE_DEPLOY=${ENABLE_DEPLOY}"
exit 0
fi
if [[ "${ACT:-false}" == "true" ]]; then
echo "Skipping deploy: act"
exit 0
fi
if [[ "${CI_PROVIDER}" != "github" ]]; then
echo "Skipping deploy: CI_PROVIDER=${CI_PROVIDER}"
exit 0
fi
- name: Checkout (tag)
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
set -euo pipefail
pip install -r mkdocs/requirements.txt
- name: Build site (strict default)
run: |
set -euo pipefail
export MKDOCS_STRICT="${MKDOCS_STRICT:-true}"
export TMPDIR="${RUNNER_TEMP:-$TMPDIR}"
export OUTPUT_DIR="${OUTPUT_DIR:-${TMPDIR}/dist/}"
tools/build.sh --config mkdocs/mkdocs.yml
- name: Checkout gh-pages branch
run: |
set -euo pipefail
git fetch origin gh-pages:gh-pages || true
if git show-ref --verify --quiet refs/heads/gh-pages; then
git switch gh-pages
else
git switch --orphan gh-pages
rm -rf ./*
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git commit --allow-empty -m "Initialize gh-pages"
fi
- name: Publish RC preview under /rc/<tag>/
run: |
export MKDOCS_STRICT="${MKDOCS_STRICT:-true}"
export TMPDIR="${RUNNER_TEMP:-$TMPDIR}"
export OUTPUT_DIR="${OUTPUT_DIR:-${TMPDIR}/dist/}"
set -euo pipefail
REF="${GITHUB_REF_NAME}"
mkdir -p "rc/${REF}"
rm -rf "rc/${REF:?}/"* || true
cp -a "$OUTPUT_DIR" "rc/${REF}/"
mkdir -p rc
if [ ! -f rc/index.html ]; then
cat > rc/index.html << 'EOF'
<!doctype html><meta charset="utf-8"><title>RC Previews</title>
<h1>Release Candidate Preview</h1>
<p><a href="rc/${REF:?}/">${REF:?}</p>
EOF
fi
git add -A
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git commit -m "Deploy RC preview ${REF}" || echo "No changes to commit"
git push origin gh-pages