-
Notifications
You must be signed in to change notification settings - Fork 9
134 lines (111 loc) · 3.84 KB
/
build.yaml
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: Build book
on:
push:
branches:
- main
- edition-*
jobs:
build-book:
runs-on: ubuntu-latest
env:
R_LIBS_USER: ~/R_libs:~/R:~/R-dev
QUARTO_VER: "1.6.1"
PANDOC_VER: "3.2"
# https://github.com/r-lib/remotes/issues/641
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
if: github.repository_owner == 'resampling-stats'
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ hashFiles('build-requirements.txt') }}
- uses: actions/cache@v3
with:
path: |
~/R
~/R_libs
~/R-dev
key: ${{ hashFiles('scripts/install_r_requirements.R') }}
- name: Apt update
run: sudo apt update
- name: Install inkscape
run: |
sudo apt update
sudo apt install inkscape
- name: Install rsvg tools
run: sudo apt install librsvg2-bin
- name: PDF build packages
run: |
sudo apt install texlive-xetex texlive-fonts-extra
- name: Install quarto and matching pandoc
run: |
sudo apt install -y curl
curl -L https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VER}/quarto-${QUARTO_VER}-linux-amd64.deb -o quarto.deb
# PANDOC appends -1 to the archive root name for .deb packages.
curl -L https://github.com/jgm/pandoc/releases/download/${PANDOC_VER}/pandoc-${PANDOC_VER}-1-amd64.deb -o pandoc.deb
sudo dpkg --install quarto.deb pandoc.deb
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install R
run: |
sudo apt install -y r-base libcurl4-openssl-dev libssl-dev libxml2-dev
R --version | grep 'version '
- name: Install R and Python libraries
run: |
sudo apt install -y libfontconfig1-dev libmagick++-dev
make build-init
- name: Build website index
run: cd website && make
- name: Deploy website index
uses: JamesIves/[email protected]
with:
folder: website
repository-name: resampling-stats/resampling-stats.github.io
branch: main
single-commit: true
token: ${{ secrets.BOOK_UPLOAD_TOKEN }}
- name: Build Python book
run: |
make py-version
cp website/python-README.md python-book/README.md
cp requirements.txt python-book
touch python-book/.nojekyll
- name: Build Python PDF
run: cd source && ninja python-book-pdf
- name: branch-to-book-suffix
run: |
branch="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
if [ "$branch" == 'main' ]; then
echo "BOOK_SUFFIX=latest" >> $GITHUB_ENV
elif [[ "$branch" =~ ^edition* ]]; then
echo "BOOK_SUFFIX=$branch" >> $GITHUB_ENV
fi
- name: Deploy Python book
uses: JamesIves/[email protected]
if: env.BOOK_SUFFIX != ''
with:
folder: python-book
repository-name: resampling-stats/${{ env.BOOK_SUFFIX }}-python
branch: main
single-commit: true
token: ${{ secrets.BOOK_UPLOAD_TOKEN }}
- name: Build R book
run: |
make r-version
cp website/r-README.md r-book/README.md
touch r-book/.nojekyll
- name: Build R PDF
run: cd source && ninja r-book-pdf
- name: Deploy R book
uses: JamesIves/[email protected]
if: env.BOOK_SUFFIX != ''
with:
folder: r-book
repository-name: resampling-stats/${{ env.BOOK_SUFFIX }}-r
branch: main
single-commit: true
token: ${{ secrets.BOOK_UPLOAD_TOKEN }}