From 120faf9e698ff6268ffcae9889c39f8f1c39402e Mon Sep 17 00:00:00 2001 From: Chris Butler Date: Tue, 19 Nov 2024 15:44:18 +1100 Subject: [PATCH 1/2] fix: correct missing script Signed-off-by: Chris Butler --- .github/workflows/docs-update.yml | 2 +- scripts/mike_version_parse.py | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 scripts/mike_version_parse.py 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..721bcf7e7 --- /dev/null +++ b/scripts/mike_version_parse.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python +"""Parsing of tags for mike.""" +import os +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 + os.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 + os.exit(0) + +os.exit(1) From f21014cfb0d4269527bde03548bb286bb35a3b77 Mon Sep 17 00:00:00 2001 From: Chris Butler Date: Sun, 1 Dec 2024 10:10:55 +1100 Subject: [PATCH 2/2] fix: correct type failures Signed-off-by: Chris Butler --- scripts/mike_version_parse.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/mike_version_parse.py b/scripts/mike_version_parse.py index 721bcf7e7..5ca088f87 100644 --- a/scripts/mike_version_parse.py +++ b/scripts/mike_version_parse.py @@ -1,6 +1,5 @@ #!/usr/bin/env python """Parsing of tags for mike.""" -import os import sys if __name__ == '__main__': @@ -11,13 +10,13 @@ assert len(components) == 3 if components[1] == 'heads' and components[2] == 'develop': print('latest') # noqa: T201 - os.exit(0) + 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 - os.exit(0) + sys.exit(0) -os.exit(1) +sys.exit(1)