-
Notifications
You must be signed in to change notification settings - Fork 145
106 lines (79 loc) · 2.42 KB
/
docs.yml
File metadata and controls
106 lines (79 loc) · 2.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
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
99
100
101
102
103
104
105
106
name: docs
on:
push:
branches:
- develop
tags:
- 'v*'
paths:
- 'docs/**'
- 'mkdocs.yml'
- '.github/workflows/docs.yml'
permissions:
contents: write
concurrency:
group: docs-deploy
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.x'
- name: Install Dependencies
run: |
pip3 install mkdocs-material mike
pip3 install mkdocs-git-revision-date-localized-plugin
pip3 install mkdocs-redirects
- name: Fetch gh-pages
run: git fetch origin gh-pages --depth=1 || true
- name: Configure git
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- name: Deploy docs with mike
shell: bash
run: |
set -e
deploy_version () {
local VERSION="$1"
local UPDATE_LATEST="${2:-false}"
VERSION="${VERSION#v}"
MINOR=$(echo "$VERSION" | sed -E 's/^([0-9]+\.[0-9]+).*/\1/')
echo "Deploying docs version: $MINOR"
if [ "$UPDATE_LATEST" = "true" ]; then
mike deploy --push --update-aliases "$MINOR" latest
return
fi
mike deploy --push "$MINOR"
}
#
# Develop branch
#
if [ "${{ github.ref_type }}" = "branch" ] && [ "${{ github.ref_name }}" = "develop" ]; then
echo "Deploying dev docs"
mike deploy --push dev
exit 0
fi
#
# Release tags
#
if [ "${{ github.ref_type }}" = "tag" ]; then
VERSION="${{ github.ref_name }}"
if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Skipping non-stable release tag: $VERSION"
exit 0
fi
deploy_version "$VERSION" true
echo "Setting default docs version: latest"
mike set-default --push latest
exit 0
fi
echo "Unsupported ref"
exit 1