-
-
Notifications
You must be signed in to change notification settings - Fork 2
57 lines (47 loc) · 1.42 KB
/
docs.yml
File metadata and controls
57 lines (47 loc) · 1.42 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
name: Documentation
on:
push:
branches:
- main
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install dependencies
run: pip install -r requirements.mkdocs.txt
- name: Configure Git
run: |
git config user.name github-actions
git config user.email github-actions@github.com
- name: Fetch gh-pages branch
run: |
if git ls-remote --exit-code --heads origin gh-pages > /dev/null 2>&1; then
git fetch origin gh-pages:gh-pages
echo "Fetched existing gh-pages branch"
else
echo "gh-pages branch does not exist yet, mike will create it"
fi
- name: Deploy docs (versioned)
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
# Always use the latest git tag as version
VERSION=$(git describe --tags --abbrev=0 | sed 's/^v//')
mike deploy --push --update-aliases "$VERSION" latest
# Re-fetch gh-pages after deploy to get the updated branch
git fetch origin gh-pages:gh-pages --force
mike set-default --push latest
# Verify
echo "Mike versions:"
mike list