-
-
Notifications
You must be signed in to change notification settings - Fork 7
78 lines (59 loc) · 2.06 KB
/
Copy pathgh-page.yml
File metadata and controls
78 lines (59 loc) · 2.06 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
name: Github pages
on:
release:
types: [published]
push:
tags:
- '*'
jobs:
build_docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.0.2
with:
fetch-depth: 0
- name: Set up Python 3.6
uses: actions/setup-python@v4.4.0
with:
python-version: 3.6
- name: Pip cache
uses: actions/cache@v3.0.4
id: pip-cache
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip
- name: Install dependencies
run: |
pip install --upgrade pip setuptools
sudo apt-get install -y --no-install-recommends python3-sphinx
make install-dev
- name: Generate docs
run: |
poetry run make build-docs
- name: Update gh-pages branch
run: |
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
#######################
# Update GitHub Pages #
#######################
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
docroot=`mktemp -d`
rsync -av "docs/build/html/" "${docroot}/"
pushd "${docroot}" || exit
touch .nojekyll
# don't bother maintaining history; just generate fresh
git init
git remote add deploy "https://token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git checkout -b gh-pages
git add .
# commit all the new files
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}"
# overwrite the contents of the gh-pages branch on our github.com repo
git push deploy gh-pages --force
popd || exit # return to main repo sandbox root
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}