-
Notifications
You must be signed in to change notification settings - Fork 88
62 lines (54 loc) · 2 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
53
54
55
56
57
58
59
60
61
62
name: Build and deploy docs
on:
pull_request:
push:
branches: [main]
tags:
- '*'
jobs:
build-deploy-docs:
# Only run this job on the popsim-consortium repository.
# The job would fail on forks anyhow, because the secret used below
# POPSIMBOT_STDPOPSIM_DOCS_TOKEN
# won't be valid. But to avoid confusion, we explicitly restrict the scope.
# See https://github.com/popsim-consortium/stdpopsim/issues/662
if: github.repository == 'popsim-consortium/stdpopsim'
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install deps
run: |
python -m pip install wheel
python -m pip install numpy==1.19.2 # for scikit-allel
python -m pip install -r requirements/CI/requirements.txt
# Install the local package so that stdpopsim is in the path,
# which is needed for generating docs `command-output`.
python -m pip install .
- name: Build Docs
run: make -C docs
- name: Checkout docs site
if: (!github.event.pull_request)
uses: actions/checkout@v2
with:
repository: popsim-consortium/stdpopsim-docs
token: ${{ secrets.POPSIMBOT_STDPOPSIM_DOCS_TOKEN }}
path: stdpopsim-docs
- name: Copy our docs to the tag specific location
if: (!github.event.pull_request)
run: |
cd stdpopsim-docs
export DEST=`echo ${GITHUB_REF} | sed -e "s/refs\/heads\///g" | sed -e "s/refs\/tags\///g"`
rm -rf $DEST
cp -r ../docs/_build/html $DEST
- name: Commit and push the docs
if: (!github.event.pull_request)
run: |
cd stdpopsim-docs
git config user.name PopSim-bot
git config user.email graham.gower+popsim-bot@gmail.com
git add .
git diff-index --quiet HEAD || git commit -m "Automated doc build for ${GITHUB_REF}"
git push