Skip to content

Merge pull request #375 from mwcraig/fix-favicon #179

Merge pull request #375 from mwcraig/fix-favicon

Merge pull request #375 from mwcraig/fix-favicon #179

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.
- photometry-dev
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
- photometry-dev
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/[email protected]
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=1
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
notebooks/photometry/*.fit*
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 .
# Workaround to enable utterances comments. See script for details.
python fix_jupyter_book_comments.py _build/html
- 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') || github.ref == 'refs/heads/photometry-dev' }}
steps:
- name: Set version number
run: |
VERSION_NUMBER=${GITHUB_REF#refs/tags/}
if [[ "${{ github.ref }}" == 'refs/heads/main' ]]; then VERSION_NUMBER=dev; fi
if [[ "${{ github.ref }}" == 'refs/heads/photometry-dev' ]]; then VERSION_NUMBER=pdev; 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@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: dev
destination_dir: v/${{ env.VERSION_NUMBER }}