Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ffcd0f48aa | |||
| ac93876087 | |||
| 368cf3edca | |||
| 279a15f6ad | |||
| 69a34a5a82 | |||
| 7d7dbe5354 | |||
| ddb44e9846 | |||
| f1f4a69bd1 | |||
| dea9106556 |
117
.github/workflows/release.yml
vendored
117
.github/workflows/release.yml
vendored
@@ -3,7 +3,7 @@ name: Build & publish docs (rc + release)
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "rc-*"
|
- "rc*"
|
||||||
- "v*"
|
- "v*"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
@@ -12,18 +12,19 @@ permissions:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
MKDOCS_CONFIG: mkdocs/mkdocs.yml
|
MKDOCS_CONFIG: mkdocs/mkdocs.yml
|
||||||
MKDOCS_OUTPUT_DIR: ${{ runner.temp }}/dist
|
|
||||||
MKDOCS_STRICT: ${{ vars.MKDOCS_STRICT || 'true' }}
|
MKDOCS_STRICT: ${{ vars.MKDOCS_STRICT || 'true' }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout (tag)
|
||||||
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- uses: actions/setup-python@v5
|
- name: Setup Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: "3.11"
|
python-version: "3.11"
|
||||||
|
|
||||||
@@ -41,27 +42,51 @@ jobs:
|
|||||||
FLAGS+=(--strict)
|
FLAGS+=(--strict)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "${MKDOCS_OUTPUT_DIR}"
|
OUT_BASE="${RUNNER_TEMP}/mkdocs_out"
|
||||||
|
SITE="${OUT_BASE}/site"
|
||||||
|
SITE_OFFLINE="${OUT_BASE}/site_offline"
|
||||||
|
|
||||||
OFFLINE="${OFFLINE}" mkdocs build \
|
rm -rf "${OUT_BASE}"
|
||||||
"${FLAGS[@]}" \
|
mkdir -p "${SITE}" "${SITE_OFFLINE}"
|
||||||
-f "${MKDOCS_CONFIG}" \
|
|
||||||
-d "${MKDOCS_OUTPUT_DIR}"
|
# 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
|
||||||
|
|
||||||
- name: Zip site
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
cd "${MKDOCS_OUTPUT_DIR}"
|
|
||||||
zip -r "${GITHUB_REF_NAME}.zip" .
|
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs: build
|
||||||
steps:
|
permissions:
|
||||||
# -------------------------
|
contents: write
|
||||||
# RC-only step
|
|
||||||
# -------------------------
|
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
|
||||||
|
zip -r "${GITHUB_REF_NAME}.zip" site_offline
|
||||||
|
|
||||||
- name: Publish prerelease
|
- name: Publish prerelease
|
||||||
if: startsWith(github.ref_name, 'rc-')
|
if: startsWith(github.ref_name, 'rc')
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
prerelease: true
|
prerelease: true
|
||||||
@@ -70,11 +95,8 @@ jobs:
|
|||||||
body: |
|
body: |
|
||||||
Release candidate preview (if deployed): /rc/
|
Release candidate preview (if deployed): /rc/
|
||||||
files: |
|
files: |
|
||||||
${{ runner.temp }}/${{ github.ref_name }}.zip
|
${{ github.ref_name }}.zip
|
||||||
|
|
||||||
# -------------------------
|
|
||||||
# Final release-only step
|
|
||||||
# -------------------------
|
|
||||||
- name: Publish release
|
- name: Publish release
|
||||||
if: startsWith(github.ref_name, 'v')
|
if: startsWith(github.ref_name, 'v')
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
@@ -82,12 +104,51 @@ jobs:
|
|||||||
name: ${{ github.ref_name }}
|
name: ${{ github.ref_name }}
|
||||||
tag_name: ${{ github.ref_name }}
|
tag_name: ${{ github.ref_name }}
|
||||||
files: |
|
files: |
|
||||||
${{ runner.temp }}/${{ github.ref_name }}.zip
|
${{ github.ref_name }}.zip
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs: build
|
||||||
steps:
|
permissions:
|
||||||
- name: Deploy
|
contents: write
|
||||||
run: |
|
|
||||||
echo "TBD :)"
|
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Download normal site artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: site
|
||||||
|
path: site
|
||||||
|
|
||||||
|
- 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
|
||||||
|
rm -rf ./*
|
||||||
|
cp -a ../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: Deploy RC preview to /rc/
|
||||||
|
if: startsWith(github.ref_name, 'rc')
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
rm -rf rc
|
||||||
|
mkdir -p rc
|
||||||
|
cp -a ../site/. rc/
|
||||||
|
# optional metadata for your toolbar link idea:
|
||||||
|
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