Skip to content

docs: Only publish docs for versions >= 1.0 #137

docs: Only publish docs for versions >= 1.0

docs: Only publish docs for versions >= 1.0 #137

Workflow file for this run

name: Docs
on:
push:
branches: [ main ]
tags: [ 'v*' ]
workflow_dispatch:
permissions: {}
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Set up uv
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
with:
enable-cache: false
version-file: uv.lock
- name: Build docs for all releases and main
run: |
(echo dev && git tag -l "v[1-9]*") | while read -r tag; do
echo "::group::Processing release: $tag"
[[ "$tag" == "dev" ]] && git checkout main || git checkout $tag
uv run --frozen zensical build --strict
mkdir -p "docs-build/$tag"
mv site/* "docs-build/$tag"
echo "::endgroup::"
done
# Create versions.json at root
(cd docs-build; printf '%s\n' * | jq -R . | jq -s 'map({version: ., title: ., aliases: []})' > versions.json)
# Create redirect to dev docs at root
cat <<EOF > docs-build/index.html
<!DOCTYPE html>
<html>
<head><meta http-equiv="refresh" content="0; url=dev/"></head>
<body><a href="dev/">Redirecting...</a></body>
</html>
EOF
- name: Upload artifact
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: ./docs-build
deploy:
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1