Skip to content

Deploy Documents 5.8 #19

Deploy Documents 5.8

Deploy Documents 5.8 #19

name: Deploy Documents
env:
PYTHON_VERSION: "3.9"
on:
push:
branches:
# Branch to base "dev" website on. Set in siteversion.py also.
- master
# Release branches have names like 0.8.x, 0.9.x, ...
- "[0-9]+.[0-9]+.x"
create:
jobs:
pre-publish:
runs-on: ubuntu-latest
outputs:
result: ${{ steps.determination.outputs.result }}
steps:
- name: Determine if documentation should be published on this workflow run
id: determination
run: |
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
if [[ "${{ github.event_name }}" == "push" || ( "${{ github.event_name }}" == "create" && "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX ) ]]; then
RESULT="true"
else
RESULT="false"
fi
echo "result=$RESULT" >> $GITHUB_OUTPUT
echo "Deploy documents: $RESULT"
publish:
runs-on: ubuntu-latest
needs: pre-publish
if: needs.pre-publish.outputs.result == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Requirements
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Create all generated documentation content
run: mkdocs build
- name: Determine versioning parameters
id: determine-versioning
run: echo 'data={"version":"5.4", "alias":"latest"}' >> $GITHUB_OUTPUT
- name: Deploy
if: fromJson(steps.determine-versioning.outputs.data).version != null
run: |
# Publishing implies creating a git commit on the production branch,
# we let @phalconbot own these commits.
git config user.name niden
git config user.email [email protected]
git fetch --no-tags --prune --depth=1 origin +refs/heads/gh-pages:refs/remotes/origin/gh-pages
mike deploy \
--update-aliases \
--push \
--remote origin \
${{ fromJson(steps.determine-versioning.outputs.data).version }} \
${{ fromJson(steps.determine-versioning.outputs.data).alias }}