Skip to content

feat/libvirt-0.8.0: Documentation #194

feat/libvirt-0.8.0: Documentation

feat/libvirt-0.8.0: Documentation #194

Workflow file for this run

#
# Documentation deployment workflow.
#
# Documentation is always deployed on a new release and commit to the 'main' branch.
# When release has a latest semantic version, a 'latest' alias is applied as well.
#
name: Documentation
run-name: "${{ github.ref_name }}: Documentation"
on:
push:
branches:
- main
create:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
precheck:
name: Precheck
runs-on: ubuntu-latest
outputs:
version: ${{ steps.check.outputs.version }}
release: ${{ steps.check.outputs.release }}
steps:
- name: Extract version
id: check
run: |-
ref_type="${{ github.ref_type }}"
version="${{ github.ref_name }}"
release="false"
if [ "${ref_type}" == "tag" ]; then
# Trim patch number.
version="${version%.*}"
release="true"
fi
if [ "${ref_type}" == "branch" ] && [ "${version}" == "main" ]; then
release=true
fi
echo "version=${version}" >> $GITHUB_OUTPUT
echo "release=${release}" >> $GITHUB_OUTPUT
deploy_docs:
name: Deploy documentation
runs-on: ubuntu-latest
needs: [precheck]
if: needs.precheck.outputs.release == 'true'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get latest tag
id: latest_tag
uses: oprypin/find-latest-tag@v1
with:
repository: ${{ github.repository }}
regex: '^v\d+\.\d+\.\d+$'
- name: Fetch gh-pages
run: |
git config user.name github-actions
git config user.email [email protected]
git fetch origin gh-pages --depth=1
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Deploy documentation
env:
version: ${{ needs.precheck.outputs.version }}
latest: ${{ github.ref_name == steps.latest_tag.outputs.tag && 'latest' || '' }}
run: |
pip install -r docs/requirements.txt
mike deploy --push --update-aliases ${version} ${latest}