Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dcfe8872de | |||
| 1556b4fff7 | |||
| ffcd0f48aa | |||
| ac93876087 | |||
| 368cf3edca | |||
| 279a15f6ad | |||
| 69a34a5a82 |
74
.github/workflows/deploy-pages.yml
vendored
74
.github/workflows/deploy-pages.yml
vendored
@@ -1,74 +0,0 @@
|
||||
name: Release - Build and publish docs
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ["v*"]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- 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: CI gate build (strict)
|
||||
env:
|
||||
MKDOCS_STRICT: ${{ vars.MKDOCS_STRICT }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
export MKDOCS_STRICT="${MKDOCS_STRICT:-true}"
|
||||
tools/mkdocs_build.sh --config mkdocs/mkdocs.yml
|
||||
|
||||
- name: Package site (non-strict)
|
||||
run: |
|
||||
set -euo pipefail
|
||||
export MKDOCS_STRICT="false"
|
||||
scripts/package_site.sh "${GITHUB_REF_NAME}" --config mkdocs/mkdocs.yml --dist "${RUNNER_TEMP}/dist"
|
||||
|
||||
- name: Publish release (GitHub)
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
name: ${{ github.ref_name }}
|
||||
tag_name: ${{ github.ref_name }}
|
||||
files: |
|
||||
${{ runner.temp }}/dist/${{ github.ref_name }}.zip
|
||||
|
||||
- name: Remove RC preview from gh-pages (optional cleanup)
|
||||
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
|
||||
echo "No gh-pages branch; nothing to clean."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -d rc ]; then
|
||||
rm -rf rc
|
||||
git add -A
|
||||
git config user.name "actions-bot"
|
||||
git config user.email "actions-bot@users.noreply.github.com"
|
||||
git commit -m "Remove RC preview after release ${GITHUB_REF_NAME}" || echo "No changes to commit"
|
||||
git push origin gh-pages
|
||||
else
|
||||
echo "No rc/ directory present; nothing to delete."
|
||||
fi
|
||||
76
.github/workflows/deploy-rc-pages.yml
vendored
76
.github/workflows/deploy-rc-pages.yml
vendored
@@ -1,76 +0,0 @@
|
||||
name: Deploy RC preview to GitHub Pages
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ["rc*"]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
deploy-rc-pages:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- 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 TMPDIR="${RUNNER_TEMP:-$TMPDIR}"
|
||||
export OUTPUT_DIR="${OUTPUT_DIR:-${TMPDIR}/dist/}"
|
||||
|
||||
set -euo pipefail
|
||||
rm -rf "rc"* || true
|
||||
mkdir -p "rc/"
|
||||
cp -a "$OUTPUT_DIR/." "rc/"
|
||||
|
||||
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 ${GITHUB_REF_NAME}" || echo "No changes to commit"
|
||||
git push origin gh-pages
|
||||
- name: Publish prerelease (GitHub)
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
prerelease: true
|
||||
body: |
|
||||
RC preview: https://<org>.github.io/<repo>/rc/
|
||||
|
||||
Tag: ${{ github.ref_name }}
|
||||
Commit: ${{ github.sha }}
|
||||
93
.github/workflows/release.yml
vendored
93
.github/workflows/release.yml
vendored
@@ -8,22 +8,24 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
contents: write
|
||||
|
||||
env:
|
||||
MKDOCS_CONFIG: mkdocs/mkdocs.yml
|
||||
MKDOCS_OUTPUT_DIR: ${{ runner.temp }}/dist
|
||||
MKDOCS_STRICT: ${{ vars.MKDOCS_STRICT || 'true' }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout (tag)
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
@@ -32,7 +34,7 @@ jobs:
|
||||
set -euo pipefail
|
||||
pip install -r mkdocs/requirements.txt
|
||||
|
||||
- name: Build docs (strict gate)
|
||||
- name: Build docs (normal + offline, strict gate)
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
@@ -41,29 +43,22 @@ jobs:
|
||||
FLAGS+=(--strict)
|
||||
fi
|
||||
|
||||
mkdir -p "${MKDOCS_OUTPUT_DIR}"
|
||||
OUT_BASE="${RUNNER_TEMP}/mkdocs_out"
|
||||
SITE="${OUT_BASE}/site"
|
||||
SITE_OFFLINE="${OUT_BASE}/site_offline"
|
||||
|
||||
OFFLINE="${OFFLINE:-true}" mkdocs build \
|
||||
"${FLAGS[@]}" \
|
||||
-f "${MKDOCS_CONFIG}" \
|
||||
-d "${MKDOCS_OUTPUT_DIR}/offline"
|
||||
mkdocs build \
|
||||
"${FLAGS[@]}" \
|
||||
-f "${MKDOCS_CONFIG}" \
|
||||
-d "${MKDOCS_OUTPUT_DIR}/dist"
|
||||
rm -rf "${OUT_BASE}"
|
||||
mkdir -p "${SITE}" "${SITE_OFFLINE}"
|
||||
|
||||
- name: Zip site
|
||||
mkdocs build "${FLAGS[@]}" -f "${MKDOCS_CONFIG}" -d "${SITE}"
|
||||
OFFLINE=true mkdocs build "${FLAGS[@]}" -f "${MKDOCS_CONFIG}" -d "${SITE_OFFLINE}"
|
||||
|
||||
- name: Zip offline site
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cd "${MKDOCS_OUTPUT_DIR}"
|
||||
zip -r "${GITHUB_REF_NAME}.zip" "./offline"
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
# -------------------------
|
||||
# RC-only step
|
||||
# -------------------------
|
||||
cd "${RUNNER_TEMP}/mkdocs_out"
|
||||
zip -r "${GITHUB_REF_NAME}.zip" site_offline
|
||||
|
||||
- name: Publish prerelease
|
||||
if: startsWith(github.ref_name, 'rc')
|
||||
uses: softprops/action-gh-release@v2
|
||||
@@ -74,11 +69,8 @@ jobs:
|
||||
body: |
|
||||
Release candidate preview (if deployed): /rc/
|
||||
files: |
|
||||
${{ runner.temp }}/${{ github.ref_name }}.zip
|
||||
${{ runner.temp }}/mkdocs_out/${{ github.ref_name }}.zip
|
||||
|
||||
# -------------------------
|
||||
# Final release-only step
|
||||
# -------------------------
|
||||
- name: Publish release
|
||||
if: startsWith(github.ref_name, 'v')
|
||||
uses: softprops/action-gh-release@v2
|
||||
@@ -86,47 +78,38 @@ jobs:
|
||||
name: ${{ github.ref_name }}
|
||||
tag_name: ${{ github.ref_name }}
|
||||
files: |
|
||||
${{ runner.temp }}/${{ github.ref_name }}.zip
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
${{ runner.temp }}/mkdocs_out/${{ github.ref_name }}.zip
|
||||
|
||||
- name: Checkout gh-pages branch
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: gh-pages
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Deploy release to gh-pages root
|
||||
if: startsWith(github.ref_name, 'v')
|
||||
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 release
|
||||
run: |
|
||||
set -euo pipefail
|
||||
rm ./* ./.* || true
|
||||
cp -a "${MKDOCS_OUTPUT_DIR}/dist/." ""
|
||||
|
||||
cp -a ${RUNNER_TEMP}/
|
||||
/mkdocs_out/site/. .
|
||||
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 release ${GITHUB_REF_NAME}" || echo "No changes to commit"
|
||||
git push origin gh-pages
|
||||
|
||||
- name: Publish RC preview under /rc/<tag>/
|
||||
- name: Deploy RC preview to /rc/
|
||||
if: startsWith(github.ref_name, 'rc')
|
||||
run: |
|
||||
set -euo pipefail
|
||||
rm -rf "rc"* || true
|
||||
mkdir -p "rc/"
|
||||
cp -a "${MKDOCS_OUTPUT_DIR}/dist/." "rc/"
|
||||
rm -rf rc
|
||||
mkdir -p rc
|
||||
cp -a ${RUNNER_TEMP}/mkdocs_out/site/. rc/
|
||||
printf '{"tag":"%s"}\n' "${GITHUB_REF_NAME}" > rc/rc.json
|
||||
|
||||
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 ${GITHUB_REF_NAME}" || echo "No changes to commit"
|
||||
git push origin gh-pages
|
||||
|
||||
Reference in New Issue
Block a user