-
Notifications
You must be signed in to change notification settings - Fork 5
45 lines (43 loc) · 1.42 KB
/
push_docs_stable.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
name: Horace release user documentation update
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
env:
doc_root: $GITHUB_WORKSPACE/documentation/user_docs
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Update dependencies
run: |
python -m pip install --upgrade pip
python -m pip install wheel
python -m pip install -r ${{ env.doc_root }}/requirements.txt
- name: Build and Commit
run: |
tmp_dir=$(mktemp -d -t pages-XXXXXXXXXX)
sphinx-build -b html ${{ env.doc_root }}/docs $tmp_dir
rm -rf $tmp_dir/.doctrees
cd $GITHUB_WORKSPACE
git checkout --force gh-pages
rm -rf $GITHUB_REF
cp -rpav $tmp_dir $GITHUB_REF
git add $GITHUB_REF
echo "<meta http-equiv=\"Refresh\" content=\"0; url=https://pace-neutrons.github.io/Horace/$GITHUB_REF/\" />" > stable/index.html
git add stable/index.html
git config --global user.email "[email protected]"
git config --global user.name "Github Actions"
git commit --allow-empty -m "Add docs release $GITHUB_REF"
- name: Push changes
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages