-
Notifications
You must be signed in to change notification settings - Fork 7
100 lines (91 loc) · 2.92 KB
/
deploy-mkdocs.yml
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
name: Deploy MkDocs to GitHub Pages
on:
push:
branches:
- beta
- candidate/stable
- 20241118-docs-update-beta
permissions:
contents: write
pages: write
id-token: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'
- name: Install dependencies
run: |
cd docs/
pip install -r requirements.txt
- name: Build Beta Documentation
run: |
if [[ $GITHUB_REF != "refs/heads/beta" ]]; then
git fetch --depth 1 origin beta:beta
git checkout beta
fi
cd docs/
mkdocs build
mkdir -p ../gh-pages/beta
cp -R site/* ../gh-pages/beta/
- name: Build Candidate Stable Documentation
run: |
if [[ $GITHUB_REF != "refs/heads/candidate/stable" ]]; then
git fetch --depth 1 origin candidate/stable:candidate/stable
git checkout candidate/stable
fi
cd docs/
mkdocs build
mkdir -p ../gh-pages/candidate-stable
cp -R site/* ../gh-pages/candidate-stable/
- name: Create Redirect Index
run: |
cat > ./gh-pages/index.html << 'EOF'
<!DOCTYPE html>
<html>
<head>
<title>Documentation Redirect</title>
<meta http-equiv="refresh" content="0; url=beta/">
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
max-width: 600px;
margin: 50px auto;
text-align: center;
line-height: 1.6;
}
.links {
margin-top: 20px;
}
a {
color: #0366d6;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<h1>Documentation</h1>
<p>Redirecting to the latest beta documentation...</p>
<div class="links">
<p>If you are not redirected, please choose a version:</p>
<p><a href="beta/">Beta Documentation</a> | <a href="candidate-stable/">Candidate Stable Documentation</a></p>
</div>
</body>
</html>
EOF
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./gh-pages
force_orphan: true