-
Notifications
You must be signed in to change notification settings - Fork 9
60 lines (52 loc) · 1.88 KB
/
docs_pages_workflow.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
name: docs-pages-workflow
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build_docs_job:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: set up python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: prerequisites
run: |
sudo apt-get update
sudo apt-get install -y git rsync
python -m pip install --upgrade pip
pip install -e .[doc]
shell: bash
- name: assemble docs
run: |
pushd docs/
"./assemble_docs.sh"
popd
shell: bash
- name : publish docs to page
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
docroot=`mktemp -d`
rsync -av "docs/build/html/" "${docroot}/"
pushd "${docroot}"
echo "This branch is automatically generated to host the repository's github page. It is not intended to be viewed on github.com." > README.md
git init
git remote add deploy "https://token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git checkout -b gh-pages
touch .nojekyll
git add .
msg="Updating docs for commit ${GITHUB_SHA} made on `date -d"@${SOURCE_DATE_EPOCH}" --iso-8601=seconds` from ${GITHUB_REF} by ${GITHUB_ACTOR}"
git commit -am "${msg}"
git push deploy gh-pages --force
popd
shell: bash