Repository navigation
75 lines (70 loc) · 2.88 KB
/
Copy pathdocs.yml
File metadata and controls
75 lines (70 loc) · 2.88 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
name: Publish documentation
on:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: github-pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-24.04
timeout-minutes: 20
permissions:
contents: read
actions: read
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
fetch-depth: 0
persist-credentials: false
- name: Require released library code and successful master CI
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
test "$GITHUB_REF" = refs/heads/master
version="$(python3 -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"
gh release view "v$version" --json isDraft | jq -e '.isDraft == false'
git merge-base --is-ancestor "v$version" HEAD
git diff --exit-code "v$version" HEAD -- src pyproject.toml uv.lock
gh api "repos/$GITHUB_REPOSITORY/actions/workflows/ci.yml/runs?head_sha=$GITHUB_SHA&branch=master&event=push&per_page=1" |
jq -e --arg sha "$GITHUB_SHA" '.workflow_runs[0] | .head_sha == $sha and .head_branch == "master" and .event == "push" and .path == ".github/workflows/ci.yml" and .status == "completed" and .conclusion == "success"'
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
with:
version: 0.13.4
enable-cache: true
- name: Cache the locked policy tools
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/.local/share/code-polishy
key: code-polishy-${{ runner.os }}-${{ hashFiles('.code-polishy.lock.json') }}
- name: Install locked policy tools
run: ./code-polishyw setup
- name: Review dependencies
run: ./code-polishyw dependency-review --base origin/master
- name: Install locked documentation dependencies
run: uv sync --frozen --all-extras --no-build --no-install-project
- name: Build the documentation and the version 2 archive
run: |
uv run --frozen --no-sync mkdocs build --strict
git worktree add "$RUNNER_TEMP/v2-docs" v2.9.0
uv run --frozen --no-sync mkdocs build -f "$RUNNER_TEMP/v2-docs/mkdocs.yml" -d "$PWD/site/v2"
- uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: site/
retention-days: 30
deploy:
needs: build
runs-on: ubuntu-24.04
timeout-minutes: 15
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write
id-token: write
steps:
- name: Deploy the verified documentation site
id: deployment
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1