Skip to content

Bump peaceiris/actions-gh-pages from 3 to 4 #166

Bump peaceiris/actions-gh-pages from 3 to 4

Bump peaceiris/actions-gh-pages from 3 to 4 #166

Workflow file for this run

# GitHub Actions workflow for testing and continuous integration.
#
# This file performs testing using tox and tox.ini to define and configure the test environments.
name: Build and Deploy Book
on:
push:
branches:
- main # GitHub now defaults to 'main' as the name of the primary branch. Change this as needed.
tags: # run CI if specific tags are pushed
- '[0-9]+.[0-9]+.[0-9]+[a-z0-9]*' # pre-releases -- note that brackets only
# match single character, and that * does
# not mean zero or more of previous
# character.
- '[0-9]+.[0-9]+.[0-9]+' # actual releases.
pull_request:
branches: # only build on PRs against 'main'
- main
jobs:
# Github Actions supports ubuntu, windows, and macos virtual environments:
# https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
build_book:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- name: Build book
os: ubuntu-latest
python: 3.11
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3.0.3
with:
python-version: ${{ matrix.python }}
auto-update-conda: true
- name: Install base dependencies
shell: bash -l {0}
run: |
conda install -c conda-forge mamba
mamba install --quiet -c conda-forge astroquery ccdproc photutils sphinx sphinxcontrib-bibtex jupyter-book=0.13.2
conda list
conda info -e
# python -m pip install jupyter-book==0.12.1
- name: Cache
id: cache
uses: actions/cache@v4
with:
path: |
notebooks/*.fit*.bz
notebooks/example-cryo-LFC
notebooks/example-thermo-electric
notebooks/download_data.py
key: ${{ hashFiles('notebooks/*.fit*.bz', 'notebooks/example-cryo-LFC', 'notebooks/example-thermo-electric', 'notebooks/download_data.py') }}
- name: Download data
if: steps.cache.outputs.cache-hit != 'true'
shell: bash -l {0}
run: |
cd notebooks
python download_data.py
- name: Build book
shell: bash -l {0}
run: |
export GUIDE_RANDOM_SEED=4920385 # Use a seed to minimize changes in images
jb build .
- name: Upload HTML
uses: actions/upload-artifact@v4
with:
name: rendered-book-sha-${{ github.sha }}
path: |
_build/html
deploy_html:
name: Deploy
runs-on: ubuntu-latest
needs: build_book
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'tags') }}
steps:
- name: Set version number
run: |
VERSION_NUMBER=${GITHUB_REF#refs/tags/}
if [[ "${{ github.ref }}" == 'refs/heads/main' ]]; then VERSION_NUMBER=dev; fi
echo "VERSION_NUMBER=$VERSION_NUMBER" >> $GITHUB_ENV
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: rendered-book-sha-${{ github.sha }}
path: dev
- name: Deploy pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: dev
destination_dir: v/${{ env.VERSION_NUMBER }}