Repository navigation
80 lines (70 loc) · 2.81 KB
/
Copy pathdeploy.yml
File metadata and controls
80 lines (70 loc) · 2.81 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
name: Build and Deploy Docs
on:
workflow_dispatch:
inputs:
# trunk-ignore(checkov/CKV_GHA_7)
version:
description: Version to publish
required: true
type: string
set_latest:
description: Point the `latest` alias at this version (uncheck for pre-releases)
required: false
default: true
type: boolean
concurrency:
group: pages
cancel-in-progress: true
permissions:
contents: write # Needed to push to gh-pages
pages: write # Needed if using GitHub Pages
id-token: write # Needed for OIDC authentication (optional, for Pages API)
jobs:
deploy:
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: Checkout repo
uses: actions/checkout@v5.1.0
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v7.6.0
with:
enable-cache: true
cache-dependency-glob: uv.lock
- name: Set up Python
uses: actions/setup-python@v6.0.0
with:
python-version-file: .python-version
- name: Install dependencies
run: uv sync --all-extras --dev
- name: Set Git user
run: |
git config --global user.name ${{ secrets.GIT_NAME }}
git config --global user.email ${{ secrets.GIT_EMAIL }}
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git fetch -a
git pull origin main
git checkout gh-pages
git pull origin gh-pages
git checkout main
- name: Refresh generated snippets
run: |
uv run python -m scripts.gen_env_vars
uv run python -m scripts.gen_scheduled_tasks
# The site root redirects to `latest/`, so that alias is what decides
# where visitors land. A pre-release deploys without it, reachable at
# its own URL and listed in the version dropdown, but not the default.
- name: Build the documentation
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ github.event.inputs.version }}
SET_LATEST: ${{ github.event.inputs.set_latest }}
run: |
set -euo pipefail
if [ "$SET_LATEST" = "false" ]; then
uv run mike deploy --push "$VERSION"
else
uv run mike deploy --push --update-aliases "$VERSION" latest
fi