Repository navigation
98 lines (87 loc) · 3.11 KB
/
Copy pathdocs.yml
File metadata and controls
98 lines (87 loc) · 3.11 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
name: Deploy MkDocs to GitHub Pages
on:
release:
types:
- published
push:
branches:
- develop
# Manual redeploy, e.g. to refresh a release's docs after a post-release fix
# lands on develop. Always builds from the dispatched branch (normally
# develop); the inputs only control the mike version label and alias. See
# talmolab/sleap#2693 (install-doc fix that shipped after the v1.6.3 tag).
workflow_dispatch:
inputs:
version:
description: "mike version label to deploy (e.g. v1.6.3)"
required: true
type: string
alias:
description: "Alias to point at this version"
required: true
default: latest
type: choice
options:
- latest
- prerelease
- dev
- none
# Serialize all gh-pages pushes (this workflow and pr-preview.yml's deploy/cleanup
# jobs share the same group) so simultaneous pushes don't race and trip
# "rejected (fetch first)". See talmolab/sleap#2689.
concurrency:
group: gh-pages-write
cancel-in-progress: false
jobs:
docs:
name: Docs
runs-on: "ubuntu-latest"
permissions:
contents: write
steps:
- name: Checkout repo
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup UV
uses: astral-sh/setup-uv@v7
with:
python-version: "3.13"
- name: Install dependencies
run: |
uv sync --extra nn-cpu
- name: Print environment info
run: |
which python
uv pip list
uv pip freeze
- name: Setup Git user
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Build and upload docs (stable release)
if: ${{ github.event_name == 'release' && github.event.action == 'published' && !github.event.release.prerelease }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
uv run mike deploy --update-aliases --allow-empty --push "${{ github.event.release.tag_name }}" latest
- name: Build and upload docs (pre-release)
if: ${{ github.event_name == 'release' && github.event.action == 'published' && github.event.release.prerelease }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
uv run mike deploy --update-aliases --allow-empty --push "${{ github.event.release.tag_name }}" prerelease
- name: Build and upload docs (dev)
if: ${{ github.event_name == 'push' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
uv run mike deploy --update-aliases --allow-empty --push dev
- name: Build and upload docs (manual dispatch)
if: ${{ github.event_name == 'workflow_dispatch' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ALIAS="${{ inputs.alias }}"
if [ "$ALIAS" = "none" ]; then ALIAS=""; fi
uv run mike deploy --update-aliases --allow-empty --push "${{ inputs.version }}" $ALIAS