-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (58 loc) · 1.96 KB
/
docs.yml
File metadata and controls
69 lines (58 loc) · 1.96 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
name: Deploy Docs
on:
release:
types: [published]
workflow_dispatch:
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # mike needs full history to manage gh-pages
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -e ".[docs]"
pip install mike
- name: Build docs
run: mkdocs build --strict
- name: Configure git for mike
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Resolve version
id: version
run: |
if [ "${{ github.event_name }}" = "release" ]; then
VERSION="${{ github.event.release.tag_name }}"
else
VERSION="v$(grep '^version' pyproject.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')"
fi
# Strip leading 'v' for mike label (mike uses "0.2.8", not "v0.2.8")
echo "version=${VERSION#v}" >> "$GITHUB_OUTPUT"
- name: Deploy docs with mike
run: |
mike deploy --push --update-aliases ${{ steps.version.outputs.version }} latest
mike set-default --push latest
- name: Remove yanked versions from docs
run: |
for v in 1.0.0 1.0.1; do
if mike list | grep -q "^$v"; then
mike delete --push "$v"
fi
done
- name: Add root-level verification files to gh-pages
run: |
git checkout -f gh-pages
git show main:docs/BingSiteAuth.xml > BingSiteAuth.xml
git add BingSiteAuth.xml
git diff --staged --quiet || git commit -m "chore: update root verification files [skip ci]"
git push origin gh-pages
git checkout main