mirror of
https://github.com/d3vyce/fastapi-toolsets.git
synced 2026-04-15 22:26:25 +02:00
* chore: remove deprecated code * docs: update v3 migration guide * fix: pytest warnings * Version 3.0.0 * fix: docs workflows
63 lines
1.9 KiB
YAML
63 lines
1.9 KiB
YAML
name: Documentation
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v7
|
|
|
|
- name: Set up Python
|
|
run: uv python install 3.13
|
|
|
|
- run: uv sync --group dev
|
|
|
|
- name: Configure git
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
|
- name: Deploy documentation
|
|
run: |
|
|
VERSION=${GITHUB_REF_NAME#v}
|
|
MAJOR=$(echo "$VERSION" | cut -d. -f1)
|
|
DEPLOY_VERSION="v$(echo "$VERSION" | cut -d. -f1-2)"
|
|
|
|
# On new major: consolidate previous major's feature versions into vX
|
|
PREV_MAJOR=$((MAJOR - 1))
|
|
OLD_FEATURE_VERSIONS=$(uv run mike list 2>/dev/null | grep -oE "^v${PREV_MAJOR}\.[0-9]+" || true)
|
|
|
|
if [ -n "$OLD_FEATURE_VERSIONS" ]; then
|
|
LATEST_PREV_TAG=$(git tag -l "v${PREV_MAJOR}.*" | sort -V | tail -1)
|
|
|
|
if [ -n "$LATEST_PREV_TAG" ]; then
|
|
git checkout "$LATEST_PREV_TAG" -- docs/ docs_src/ src/ zensical.toml
|
|
if ! grep -q '\[project\.extra\.version\]' zensical.toml; then
|
|
printf '\n[project.extra.version]\nprovider = "mike"\ndefault = "stable"\nalias = true\n' >> zensical.toml
|
|
fi
|
|
uv run mike deploy "v${PREV_MAJOR}"
|
|
git checkout HEAD -- docs/ docs_src/ src/ zensical.toml
|
|
fi
|
|
|
|
# Delete old feature versions
|
|
echo "$OLD_FEATURE_VERSIONS" | while read -r OLD_V; do
|
|
echo "Deleting $OLD_V"
|
|
uv run mike delete "$OLD_V"
|
|
done
|
|
fi
|
|
|
|
uv run mike deploy --update-aliases "$DEPLOY_VERSION" stable
|
|
uv run mike set-default stable
|
|
git push origin gh-pages
|