Repository navigation
113 lines (99 loc) · 3.5 KB
/
Copy pathdocs.yml
File metadata and controls
113 lines (99 loc) · 3.5 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Documentation
on:
push:
branches: [master]
paths:
- "docs/**"
- "type_bridge/**"
- "mkdocs.yml"
- "scripts/gen_ref_pages.py"
- "perf/harness/render.py"
pull_request:
branches: [master]
paths:
- "docs/**"
- "type_bridge/**"
- "mkdocs.yml"
- "scripts/gen_ref_pages.py"
- "perf/harness/render.py"
# Redeploy after Perf stores a run, so /perf/ shows the new history. A
# published release's run has the tag as its branch, so no branch filter;
# pull request runs store nothing and are skipped below.
workflow_run:
workflows: [Perf]
types: [completed]
workflow_dispatch:
# Allow only one concurrent deployment
concurrency:
group: pages-${{ github.ref }}
cancel-in-progress: true
# Sets permissions for GitHub Pages deployment
permissions:
contents: read
pages: write
id-token: write
env:
CARGO_HOME: ${{ github.workspace }}/../.cargo-home
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
RUST_STABLE_TOOLCHAIN: "1.94.1"
jobs:
build:
name: Build docs
if: >-
github.event_name != 'workflow_run'
|| (github.event.workflow_run.conclusion == 'success'
&& github.event.workflow_run.event != 'pull_request')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
# /perf/ renders the history on the perf-data branch. Pull requests
# build without it, and so does a repository that has no history yet.
- name: Check out the perf history
if: github.event_name != 'pull_request'
run: |
if git ls-remote --exit-code --heads origin perf-data >/dev/null; then
git fetch --no-tags --depth=1 origin perf-data
git worktree add --detach perf-data FETCH_HEAD
echo "PERF_DATA_DIR=$GITHUB_WORKSPACE/perf-data" >> "$GITHUB_ENV"
else
echo "No perf-data branch yet; /perf/ shows no data"
fi
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.13.5"
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
toolchain: ${{ env.RUST_STABLE_TOOLCHAIN }}
- name: Cache cargo registry and build
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: type-bridge-core/target
key: ${{ runner.os }}-cargo-docs-v3-${{ hashFiles('type-bridge-core/Cargo.lock') }}
- name: Install uv
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
with:
enable-cache: true
- name: Install dependencies
run: uv sync --extra docs
- name: Build documentation
run: uv run mkdocs build --strict
- name: Upload artifact
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
with:
path: site/
deploy:
name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4