Add UML designs to developer documentation. #203
Workflow file for this run
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
# Inspired by https://github.com/rkdarst/sphinx-actions-test/blob/master/.github/workflows/sphinx-build.yml | |
name: Generate documentation | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- master | |
workflow_dispatch: | |
branches: | |
- master | |
jobs: | |
build-and-deploy: | |
name: Build and deploy to gh-pages | |
runs-on: ubuntu-latest | |
steps: | |
# | |
# Preparation | |
# | |
- name: Check out source | |
uses: actions/checkout@v3 | |
with: | |
path: stylist | |
fetch-depth: 1 | |
- name: Checkout pages | |
uses: actions/checkout@v3 | |
with: | |
ref: gh-pages | |
fetch-depth: 1 | |
path: gh-pages | |
- name: Install Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.11 | |
- name: Cache pip | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
${{ runner.os }}- | |
- name: Install system dependencies | |
run: sudo apt-get install plantuml | |
- name: Install Python dependencies | |
run: | | |
cd stylist | |
python -m pip install --upgrade pip | |
pip install .[docs] | |
- name: Debugging information | |
if: ${{ false }} | |
run: | | |
echo "github.ref:" ${{github.ref}} | |
echo "github.event_name:" ${{github.event_name}} | |
echo "github.head_ref:" ${{github.head_ref}} | |
echo "github.base_ref:" ${{github.base_ref}} | |
set -x | |
cd stylist | |
git rev-parse --abbrev-ref HEAD | |
git branch | |
git branch -a | |
git remote -v | |
python -V | |
pip list --not-required | |
pip list | |
# | |
# Documentation | |
# | |
- name: Build Sphinx docs | |
run: | | |
cd stylist/documentation | |
make html | |
# | |
# Publish | |
# | |
- name: Copy new documentation | |
if: github.event_name == 'push' && !startsWith(github.ref_name, 'v') | |
run: | | |
set -x | |
git -C gh-pages rm -r latest | |
rsync -a stylist/documentation/build/html/ gh-pages/latest/ | |
git -C gh-pages add latest | |
- name: Copy release documentation | |
if: github.event_name == 'push' && startsWith(github.ref_name, 'v') | |
run: | | |
set -x | |
rsync -a stylist/documentation/build/html/ gh-pages/${{github.ref_name}} | |
git -C gh-pages add ${{github.ref_name}} | |
stylist/.github/bin/update-index gh-pages/index.html ${{github.ref_name}} | |
git -C gh-pages add index.html | |
- name: Commit documentation | |
if: github.event_name == 'push' | |
run: | | |
set -x | |
git_changes=$(git -C gh-pages status --porcelain) | |
if [ "$git_changes" ]; then | |
git_hash=$(git -C stylist rev-parse --short "${{ github.sha }}") | |
git -C gh-pages -c "user.name=Sphinx Workflow" -c [email protected] commit -a -m "Documentation from $git_hash" | |
fi | |
- name: Push | |
if: github.event_name == 'push' | |
run: | | |
set -x | |
git -C gh-pages push |