Skip to content

Commit 71665c5

Browse files
ci: Use uv rather than a Dockerfile for mkdocs
1 parent 4e10424 commit 71665c5

File tree

12 files changed

+805
-144
lines changed

12 files changed

+805
-144
lines changed

.github/ci_generator/templates/job_steps/build_docs.jinja

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,22 @@
99
run: |
1010
mkdir -p docs/api_reference
1111
cp -r target/doc/* docs/api_reference
12-
- name: Set up QEMU
13-
uses: docker/setup-qemu-action@v3
14-
- name: Set up Docker Buildx
15-
uses: docker/setup-buildx-action@v3
16-
- name: Build and export to Docker
17-
uses: docker/build-push-action@v5
18-
with:
19-
context: docs/
20-
load: true
21-
tags: pavex-docs
12+
- name: Install uv
13+
uses: astral-sh/setup-uv@v6
14+
- name: Install the project
15+
run: uv sync --locked
2216
- name: Build docs
2317
run: |
24-
docker run --rm -v ${PWD}:/docs pavex-docs build --strict
25-
- uses: actions/upload-artifact@v4
18+
uv run mkdocs build --strict
19+
- uses: actions/upload-artifact@v5
2620
with:
2721
name: docs
2822
path: site/
2923
- name: Fix base
3024
run: |
3125
# Convert all "absolute" guide links in the reference to relative links so that we can scan for dead links
32-
sudo find . -type f -exec sed -i "s#https://pavex.dev/docs/#file:///${PWD}/site/#g" {} +
33-
sudo find . -type f -exec sed -i "s#https://pavex.dev/#file:///${PWD}/site/#g" {} +
26+
sudo find ./site -type f -exec sed -i "s#https://pavex.dev/docs/#file:///${PWD}/site/#g" {} +
27+
sudo find ./site -type f -exec sed -i "s#https://pavex.dev/#file:///${PWD}/site/#g" {} +
3428
- name: Link Checker
3529
uses: lycheeverse/lychee-action@v2
3630
with:
@@ -45,6 +39,7 @@
4539
--exclude-path="site/api_reference/pavex/time"
4640
--exclude-path="site/api_reference/help.html"
4741
--exclude-path="site/api_reference/settings.html"
42+
--exclude-path="site/404.html"
4843
--exclude=".*crate#per-style$"
4944
--exclude="https://doc.rust-lang.org/*"
5045
--exclude="https://stackoverflow.com/*"
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
permissions:
2-
pull-requests: write
3-
checks: write
41
# Run if it's a PR on the official repo or a push to `main`
52
if: |
63
(github.event_name == 'repository_dispatch' &&
@@ -10,3 +7,6 @@ if: |
107
github.event.client_payload.slash_command.args.named.sha
118
)) ||
129
(github.event_name == 'push' && github.event.repository.full_name == github.repository)
10+
permissions:
11+
pull-requests: write
12+
checks: write

.github/workflows/deploy_docs.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Deploy documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- "**[0-9]+.[0-9]+.[0-9]+*"
9+
10+
jobs:
11+
deploy-docs:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
steps:
16+
- uses: actions/checkout@v5
17+
with:
18+
fetch-depth: 0
19+
token: ${{ secrets.GITHUB_TOKEN }}
20+
- name: Install Rust stable toolchain
21+
uses: actions-rust-lang/[email protected]
22+
- name: Build API reference
23+
run: |
24+
cargo api_ref
25+
- name: Copy API reference files
26+
run: |
27+
mkdir -p docs/api_reference
28+
cp -r target/doc/* docs/api_reference
29+
- name: Install uv
30+
uses: astral-sh/setup-uv@v6
31+
- name: Install Python dependencies
32+
run: uv sync --locked
33+
- name: Setup git
34+
run: |
35+
git config --global user.name "GitHub Actions"
36+
git config --global user.email "[email protected]"
37+
git fetch origin gh-pages:gh-pages || true
38+
- name: Update unstable documentation
39+
if: github.ref == 'refs/heads/main'
40+
run: |
41+
uv run mike deploy --push --allow-empty unstable
42+
- name: Update release documentation (tag -> x.y.x)
43+
if: startsWith(github.ref, 'refs/tags/')
44+
run: |
45+
TAG="${GITHUB_REF#refs/tags/}"
46+
TAG="${TAG#v}"
47+
VERSION="${TAG%.*}.x" # Deploy `0.2.7` under `0.2.x`
48+
uv run mike deploy --push --update-aliases "$VERSION" latest

0 commit comments

Comments
 (0)