-
Notifications
You must be signed in to change notification settings - Fork 15
72 lines (62 loc) · 2.1 KB
/
build.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
63
64
65
66
67
68
69
70
71
72
# Based on https://github.com/executablebooks/github-action-demo
name: build
on:
pull_request:
push:
branches: [main]
tags:
- '*'
# This job installs dependencies, build the book, and pushes it to `gh-pages`
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.0
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
# Install dependencies
- name: Install Graphviz
run: |
sudo apt-get install graphviz {lib,}graphviz-dev
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- name: Install python dependencies
run: |
pip install --upgrade pip wheel
pip install -r requirements-CI.txt
- name: Install R support
run: |
# We need to remove R to pull in a version that's compatible with CRAN, weirdly.
sudo apt-get update
sudo apt-get remove r-base-core
sudo apt-get install r-cran-reticulate r-cran-pbdzmq r-cran-uuid r-cran-ape
sudo R -e 'install.packages("IRkernel")'
R -e 'IRkernel::installspec()'
# Build the book
- name: Build the book
run: ./build.sh
- name: Copy files for users to run tutorials
run: |
cp ./requirements.txt ./_build/html/.
cp -r data ./_build/html/examples
ls data > ./_build/html/examples/files.txt
# Push the book's HTML to github-pages
- name: GitHub Pages action
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3.9.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_build/html
- name: Trigger docs site rebuild
if: github.ref == 'refs/heads/main'
run: |
curl -X POST https://api.github.com/repos/tskit-dev/tskit-site/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
-u AdminBot-tskit:${{ secrets.ADMINBOT_TOKEN }} \
--data '{"event_type":"build-docs"}'