diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index 8db66fabb..a4236f937 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -557,10 +557,14 @@ jobs: if [[ "${IS_LATEST}" == "True" ]]; then ALL_IMAGE_TAGS="${ALL_IMAGE_TAGS},${IMAGE_BASE}:latest" fi + + IS_PRERELEASE=$(poetry run python script/make_utils/is_prerelease.py "${PROJECT_VERSION}") echo "PROJECT_VERSION=${PROJECT_VERSION}" >> "$GITHUB_ENV" echo "GIT_TAG=${GIT_TAG}" >> "$GITHUB_ENV" + echo "IS_LATEST=${IS_LATEST}" >> "$GITHUB_ENV" + echo "IS_PRERELEASE=${IS_PRERELEASE}" >> "$GITHUB_ENV" echo "ALL_IMAGE_TAGS=${ALL_IMAGE_TAGS}" >> "$GITHUB_ENV" echo "VERSIONED_IMAGE_TAG=${IMAGE_BASE}:${GIT_TAG}" >> "$GITHUB_ENV" diff --git a/script/make_utils/is_prerelease.py b/script/make_utils/is_prerelease.py new file mode 100644 index 000000000..e43ae01f5 --- /dev/null +++ b/script/make_utils/is_prerelease.py @@ -0,0 +1,28 @@ +""" +Simple script to check if a given version is a pre-release version. +""" + +import sys + +from semver import VersionInfo + + +def is_prerelease(version: VersionInfo): + """ + Get if `version` is a pre-release version. + """ + + return version.prerelease is not None + + +def main(): + """ + Run the script. + """ + + version = VersionInfo.parse(sys.argv[1]) + print(str(is_prerelease(version)).lower()) + + +if __name__ == "__main__": + main()