Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1556b4fff7 |
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 }}
|
||||
58
.github/workflows/release.yml
vendored
58
.github/workflows/release.yml
vendored
@@ -8,15 +8,16 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
contents: write
|
||||
|
||||
env:
|
||||
MKDOCS_CONFIG: mkdocs/mkdocs.yml
|
||||
MKDOCS_STRICT: ${{ vars.MKDOCS_STRICT || 'true' }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout (tag)
|
||||
uses: actions/checkout@v4
|
||||
@@ -33,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
|
||||
|
||||
@@ -49,40 +50,13 @@ jobs:
|
||||
rm -rf "${OUT_BASE}"
|
||||
mkdir -p "${SITE}" "${SITE_OFFLINE}"
|
||||
|
||||
# Normal build
|
||||
mkdocs build "${FLAGS[@]}" -f "${MKDOCS_CONFIG}" -d "${SITE}"
|
||||
|
||||
# Offline build (only matters if your mkdocs.yml/plugins read OFFLINE)
|
||||
OFFLINE=true mkdocs build "${FLAGS[@]}" -f "${MKDOCS_CONFIG}" -d "${SITE_OFFLINE}"
|
||||
|
||||
- name: Upload site artifact (normal)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: site
|
||||
path: ${{ runner.temp }}/mkdocs_out/site
|
||||
|
||||
- name: Upload site artifact (offline)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: site_offline
|
||||
path: ${{ runner.temp }}/mkdocs_out/site_offline
|
||||
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Download offline site artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: site_offline
|
||||
path: site_offline
|
||||
|
||||
- name: Zip offline site
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cd "${RUNNER_TEMP}/mkdocs_out"
|
||||
zip -r "${GITHUB_REF_NAME}.zip" site_offline
|
||||
|
||||
- name: Publish prerelease
|
||||
@@ -95,7 +69,7 @@ jobs:
|
||||
body: |
|
||||
Release candidate preview (if deployed): /rc/
|
||||
files: |
|
||||
${{ github.ref_name }}.zip
|
||||
${{ runner.temp }}/mkdocs_out/${{ github.ref_name }}.zip
|
||||
|
||||
- name: Publish release
|
||||
if: startsWith(github.ref_name, 'v')
|
||||
@@ -104,20 +78,7 @@ jobs:
|
||||
name: ${{ github.ref_name }}
|
||||
tag_name: ${{ github.ref_name }}
|
||||
files: |
|
||||
${{ github.ref_name }}.zip
|
||||
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Download normal site artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: site
|
||||
path: site
|
||||
${{ runner.temp }}/mkdocs_out/${{ github.ref_name }}.zip
|
||||
|
||||
- name: Checkout gh-pages branch
|
||||
uses: actions/checkout@v4
|
||||
@@ -130,7 +91,7 @@ jobs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
rm -rf ./*
|
||||
cp -a ../site/. .
|
||||
cp -a ../mkdocs_out/site/. .
|
||||
git add -A
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
@@ -143,8 +104,7 @@ jobs:
|
||||
set -euo pipefail
|
||||
rm -rf rc
|
||||
mkdir -p rc
|
||||
cp -a ../site/. rc/
|
||||
# optional metadata for your toolbar link idea:
|
||||
cp -a ../mkdocs_out/site/. rc/
|
||||
printf '{"tag":"%s"}\n' "${GITHUB_REF_NAME}" > rc/rc.json
|
||||
|
||||
git add -A
|
||||
|
||||
Reference in New Issue
Block a user