diff --git a/.github/workflows/docs-update.yml b/.github/workflows/docs-update.yml index 8e4d0951c..11a660bb7 100644 --- a/.github/workflows/docs-update.yml +++ b/.github/workflows/docs-update.yml @@ -38,7 +38,7 @@ jobs: python-version: ${{ needs.set-versions.outputs.max }} - id: versions run: | - mike_version=$(python ./scripts/check-version.py ${{ env.GITHUB_REF }}) + mike_version=$(python ./scripts/mike_version_parse.py ${{ env.GITHUB_REF }}) echo "mver=$mike_version" >> $GITHUB_OUTPUT deploy-docs: runs-on: ubuntu-latest diff --git a/scripts/mike_version_parse.py b/scripts/mike_version_parse.py new file mode 100644 index 000000000..5ca088f87 --- /dev/null +++ b/scripts/mike_version_parse.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Parsing of tags for mike.""" +import sys + +if __name__ == '__main__': + assert len(sys.argv) == 2 + revision = sys.argv[1] + + components = revision.split('/') + assert len(components) == 3 + if components[1] == 'heads' and components[2] == 'develop': + print('latest') # noqa: T201 + sys.exit(0) + elif components[1] == 'tags' and components[2][0] == 'v': + versions = components[2][1:].split('.') + if 'rc' in components[2][1:]: + print(components[2][1:]) # noqa: T201 + else: + print(f'{versions[0]}.{versions[1]}') # noqa: T201 + sys.exit(0) + +sys.exit(1)