Skip to content

Commit

Permalink
Update documentation gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
MusicDin committed Jun 2, 2022
1 parent 37ff48b commit e20c47d
Showing 1 changed file with 47 additions and 5 deletions.
52 changes: 47 additions & 5 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,58 @@ name: documentation
on:
push:
branches:
- master
#- feature/multiple-servers
- "release-*"
#- master
release:
types:
- published

env:
PYTHON_VERSION: 3.x

jobs:
documentation:
name: Build documentation

# Documentation is deployed only on the latest release branch or on the new latest
# release tag. This prevents bug fixes in older releases from overwriting the latest
# documentation.
check:
name: Check if docs should be deployed
runs-on: ubuntu-latest
outputs:
deploy: ${{ steps.verify.outputs.deploy }}
steps:
- name: Extract release version from the branch name (or tag)
id: branch_version
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const branchName = process.env.GITHUB_REF_NAME
const prefix = 'v'
const releaseVersion = branchName.substring(branchName.lastIndexOf('-') + 1, branchName.length)
return releaseVersion.startsWith(prefix) ? releaseVersion : prefix + releaseVersion
- name: Get latest repository version
id: latest_release_version
uses: oprypin/[email protected]
with:
repository: ${{ github.repository }}
prefix: 'v'

- name: Verify if the latest version contains current branch/tag version
id: verify
env:
LATEST_VERSION: ${{ steps.latest_release_version.outputs.tag }}
BRANCH_VERSION: ${{ steps.branch_version.outputs.result }}
run: |
echo "::set-output name=deploy::${{ contains(env.LATEST_VERSION, env.BRANCH_VERSION) }}"
documentation:
name: Build and deploy docs
runs-on: ubuntu-latest
needs: check
if: needs.check.outputs.deploy == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v3

Expand All @@ -36,4 +76,6 @@ jobs:
pymdown-extensions>=9.3
- name: Deploy documentation
run: mkdocs gh-deploy --force
run: |
mkdocs gh-deploy --force

0 comments on commit e20c47d

Please sign in to comment.