Merge branch 'main' into edition-3 #435
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 python-book-jl | |
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-book-jl | |
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 }} |