-
Notifications
You must be signed in to change notification settings - Fork 5
72 lines (59 loc) · 1.95 KB
/
docs.yml
File metadata and controls
72 lines (59 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Deploy Documentation
on:
push:
branches:
- main
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
# Serialize the entire workflow (build + deploy) to prevent race conditions.
# If two runs trigger concurrently (e.g. a push to main and a tag), the second
# queues until the first finishes. This ensures the gh-pages checkout always
# reflects the latest deployed state.
concurrency:
group: pages
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: extractions/setup-just@v3
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.5.1"
# Fetch existing site from gh-pages so previous versions are preserved.
# The gh-pages branch is the source of truth for the deployed site.
- name: Download existing site from gh-pages
uses: actions/checkout@v6
with:
ref: gh-pages
path: target/site
continue-on-error: true
# actions/checkout creates a .git/ directory inside target/site.
# Remove it so the deploy action doesn't push git metadata.
- name: Remove git metadata from site checkout
run: rm -rf target/site/.git
- name: Determine version
id: version
run: |
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
echo "version=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
else
echo "version=dev" >> "$GITHUB_OUTPUT"
fi
- name: Build versioned documentation
run: just doc-deploy ${{ steps.version.outputs.version }}
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./target/site
publish_branch: gh-pages