Skip to content

Documentation

Documentation #4

Workflow file for this run

name: Documentation
on:
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
fetch-depth: 0
- name: Install `python` ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
# See https://github.com/astropy/astropy/issues/11725
python-version: "3.9"
- name: Print `python` Version
id: full-python-version
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
- name: Install and Configure Poetry
uses: snok/[email protected]
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Print `poetry` Version
run: poetry --version
- name: Setup `python` Cache
uses: actions/cache@v3
id: python-cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
- name: Verify `python` Cache is Healthy
if: steps.python-cache.outputs.cache-hit == 'true'
run: |
# `timeout` is not available on macOS, so we define a custom function.
[ "$(command -v timeout)" ] || function timeout() { perl -e 'alarm shift; exec @ARGV' "$@"; }
# Using `timeout` is a safeguard against the Poetry command hanging for some reason.
timeout 10s poetry run pip --version || rm -rf .venv
- name: Install Dependencies
if: steps.python-cache.outputs.cache-hit != 'true'
run: |
poetry run python -m pip install --upgrade pip
poetry install
poetry run python -m pip install tox-gh-actions
poetry run python -m pip install pytest-github-actions-annotate-failures
- name: Build Docs
run: |
poetry run make -C docs html
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: docs/_build/html/
user_name: "github-actions[bot]"
user_email: "github-actions[bot]@users.noreply.github.com"
full_commit_message: ${{ github.event.head_commit.message }}