Skip to content

Documentation CI changes #4

Documentation CI changes

Documentation CI changes #4

Workflow file for this run

name: Documentation
on:
release:
types:
- published
- deleted
push:
branches:
- main
pull_request:
branches:
- 'main'
permissions:
contents: write
jobs:
documentation:
env:
DOCS_BRANCH: docs-site
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ env.DOCS_BRANCH }}
uses: actions/checkout@v4
with:
ref: ${{ env.DOCS_BRANCH }}
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- name: Install Poetry
run: pipx install poetry==1.8.3
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "poetry"
- name: Install project and dependencies
run: |
poetry install --sync
poetry env info
- name: Generate markdown
run: poetry run bash scripts/generate_instructions.sh
- name: "Build/Deploy/Delete documentation"
run: |
if [[ "${{ github.event_name }}" == "push" && "${{ github.event.ref }}" == "refs/heads/main" ]]; then
echo "Updating 'dev' documentation"
poetry run mike deploy --push --branch=${{ env.DOCS_BRANCH }} dev
elif [[ "${{ github.event_name }}" == "release" && "${{ github.event.action }}" == "published" ]]; then
echo "Creating documentation version ${{ github.ref_name }}"
poetry run mike deploy --push --branch=${{ env.DOCS_BRANCH }} --update-aliases ${{ github.ref_name }} latest
poetry run mike set-default --push --branch=${{ env.DOCS_BRANCH }} latest
elif [[ "${{ github.event_name }}" == "release" && "${{ github.event.action }}" == "deleted" ]]; then
echo "Deleting documentation version ${{ github.ref_name }}"
poetry run mike delete --push --branch=${{ env.DOCS_BRANCH }} ${{ github.ref_name }}
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "Building documentation for pull request, not publishing."
poetry run mkdocs build
fi