Skip to content

Release v1.12.0

Release v1.12.0 #55

Workflow file for this run

name: Build Docs for releases
on:
release:
types: [published]
# No permissions by default
permissions: {}
jobs:
Build-Docs:
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- name: Harden the runner (audit all outbound calls)
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install tox
sudo apt-get install pandoc graphviz
- name: Build-Docs
run: |
tox -e build-docs
- name: Create gh-pages branch
env:
TAG_NAME: ${{ github.event.release.tag_name }}
run: |
existed_in_remote=$(git ls-remote --heads origin gh-pages)
if [[ -z ${existed_in_remote} ]]; then
echo "Creating gh-pages branch"
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git checkout --orphan gh-pages
git reset --hard
touch .nojekyll
git add .nojekyll
git commit -m "Initializing gh-pages branch"
git push origin gh-pages
git checkout "$TAG_NAME"
echo "Created gh-pages branch"
else
echo "Branch gh-pages already exists"
fi
- name: Commit docs to gh-pages branch
env:
TAG_NAME: ${{ github.event.release.tag_name }}
run: |
git fetch
git checkout gh-pages
mkdir -p /tmp/docs_build
cp -r docs/build/html/* /tmp/docs_build/
rm -rf $TAG_NAME/*
echo '<html><head><meta http-equiv="refresh" content="0; url=stable/" /></head></html>' > index.html
mkdir -p $TAG_NAME
cp -r /tmp/docs_build/* ./$TAG_NAME
ln -sfn $TAG_NAME stable
rm -rf /tmp/docs_build
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add ./index.html ./stable $TAG_NAME
git commit -m "Update documentation" -a || true
- name: Push changes
uses: ad-m/github-push-action@77c5b412c50b723d2a4fbc6d71fb5723bcd439aa # v1.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages