Merge pull request #127 from ukhsa-collaboration/dev #25
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 | |
# only run when specific files change | |
# only run on install-fix-docs branch | |
# TODO change this to dev/main branch once integrated | |
on: | |
push: | |
branches: | |
- master | |
- dev | |
jobs: | |
build-book: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# Fetch tag manually because fetch-tags option for checkout@v4 does not work | |
- name: Fetch tag annotations | |
run: | | |
# Fetch tag manually because fetch-tags option for checkout@v4 does not work | |
git fetch --force --tags --depth 1 | |
- id: read_tag | |
name: Set VERSION env variable | |
if: ${{ startsWith(github.ref, 'refs/tags') }} | |
run: | | |
# Set tag from GitHub: using git describe for tags inside the run script | |
# seems not working | |
echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Graphviz | |
uses: ts-graphviz/setup-graphviz@v1 | |
# install python | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
# set up pygom | |
- name: Build and install pygom | |
run: | | |
python -m pip install --upgrade pip | |
pip install . | |
# install dependencies | |
- name: Install documentation dependencies | |
run: | | |
pip install -r docs/requirements.txt | |
# build the book | |
# TODO check which flags are needed, -W | |
- name: Build the book | |
run: | | |
jupyter-book build --all -v docs/ | |
# deploy book to github-pages | |
- name: GitHub Pages | |
uses: peaceiris/actions-gh-pages@v4 | |
if: github.ref == 'refs/heads/master' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: docs/_build/html | |
# deploy book to github-pages dev | |
- name: GitHub Pages dev | |
uses: peaceiris/actions-gh-pages@v4 | |
if: github.ref == 'refs/heads/dev' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: docs/_build/html | |
destination_dir: dev |