-
Notifications
You must be signed in to change notification settings - Fork 61
62 lines (59 loc) · 2.06 KB
/
push-doc.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
name: "Push RTD on gh-pages"
on:
push:
branches:
- master
- dev
schedule:
# * is a special character in YAML
# setup monthly background build
- cron: '45 4 20 * *'
# gh-pages have a lifetime ? 90 days ? so we do this once a month to refresh
jobs:
docs:
runs-on: ubuntu-latest
env:
sphinx_html_baseurl: 'https://spinalhdl.github.io/SpinalDoc-RTD/master/'
sphinx_github_url: 'https://github.com/SpinalHDL/SpinalDoc-RTD'
sphinx_extra_version: 'master'
if: github.event.head_commit.author.email != 'action.github.com'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build docker image
uses: docker/build-push-action@v3
with:
context: .
load: true
push: false
cache-to: type=gha
cache-from: type=gha
tags: spinaldoc-pdf
file: pdf.Dockerfile
- name: Build zh-cn translated doc
run: docker run --rm -u $(id -u $USER):$(id -g $USER) -v $PWD:/docs -e sphinx_html_baseurl -e sphinx_github_url spinaldoc-pdf sphinx-build -b html -D language=zh_CN ./source/ docs/html/zh_CN
- name: Build multiversioned doc
run: docker run --rm -u $(id -u $USER):$(id -g $USER) -v $PWD:/docs -e sphinx_html_baseurl -e sphinx_github_url spinaldoc-pdf sphinx-multiversion source docs/html
- name: Add .nojekill
run: sudo touch docs/html/.nojekyll
- name: Add redirection to master
run: |
sudo tee docs/html/index.html << EOF
<!DOCTYPE html>
<html>
<head>
<title>Redirecting to ${sphinx_extra_version}</title>
<meta charset="utf-8">
<meta http-equiv="refresh" content="0; url=./${sphinx_extra_version}/index.html">
<link rel="canonical" href="${sphinx_html_baseurl}index.html">
</head>
</html>
EOF
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: docs/html