-
Notifications
You must be signed in to change notification settings - Fork 94
82 lines (72 loc) · 2.93 KB
/
docs.yml
File metadata and controls
82 lines (72 loc) · 2.93 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
79
80
81
82
name: Build and deploy docs
on:
pull_request_target:
push:
branches: [master]
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-18.04
steps:
- uses: actions/checkout@v2
# As we are using pull-request-target which uses the workflow from the base
# of the PR, we need to be specific
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install deps
run: |
sudo apt-get install libgsl-dev # for msprime
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 `comand-output`.
python -m pip install .
- name: Build Docs
run: make -C docs
- name: Checkout docs site
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 PR specific location
if: github.event.pull_request
run: |
cd stdpopsim-docs
rm -rf ${{github.event.pull_request.number}}
cp -r ../docs/_build/html ${{github.event.pull_request.number}}
- 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
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.event.pull_request.number}} ${GITHUB_REF}"
git push
- name: Comment on PR
if: github.event.pull_request
uses: mshick/add-pr-comment@v1
with:
message: |
📖 Docs for this PR can be previewed [here](https://popsim-consortium.github.io/stdpopsim-docs/${{github.event.pull_request.number}}/)
allow-repeats: false
repo-token: ${{ secrets.POPSIMBOT_STDPOPSIM_DOCS_TOKEN }}