-
Notifications
You must be signed in to change notification settings - Fork 69
53 lines (52 loc) · 1.85 KB
/
docs.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
name: docs
on:
push:
branches:
- main
- feature/docs_fix
- feature/new_docs
jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
python: [ 3.9.5 ]
steps:
- name: install pandoc
run: |
sudo apt-get install pandoc
sudo apt-get install --reinstall python3-pkg-resources
- uses: actions/setup-python@v2
- uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- name: Build and Commit
uses: sphinx-notes/pages@v2
with:
documentation_path: docs/source
requirements_path: docs/docs-requirements.txt
- name: checkout v0.3.x archive
# Please do not change any step in here, even though it may look hacky
# This is the only way to emulate git archive --remote with actions/checkout
# git checkout gh-pages-v0.3.x is required to have a local branch for archiving
# git pull is optional, but it's a good practice to have the latest version
# git checkout gh-pages right after is required to go back to the working branch
# mkdir ./v0.3.x is required to create a directory for the archive
# git archive gh-pages-v0.3.x | tar -x -C ./v0.3.x is required to extract the archive
# in the right place
# git add --all is required to add the new files to the working branch
# git commit -am "Adding v0.3.x docs" is required to commit the changes
run: |
git checkout gh-pages-v0.3.x
git pull
git checkout gh-pages
mkdir ./v0.3.x
git archive gh-pages-v0.3.x | tar -x -C ./v0.3.x
git add --all
git commit -am "Adding v0.3.x docs"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages