From 2c930d7f28de079b70664568175c910c7f540d58 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Tue, 6 Aug 2024 10:38:57 -0400 Subject: [PATCH] docs: just use major and minor for docs site dropdown --- .github/workflows/docs.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 35ea4e3..614374e 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -56,7 +56,10 @@ jobs: if current_version == release_tag: docs_alias = 'latest' - docs_version = release_tag + # set version to just major and minor + semver_pattern = '(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)(?:-(?P(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?' + release_semver = re.match(semver_pattern, release_tag) + docs_version = f"{release_semver.group('major')}.{release_semver.group('minor')}" else: semver_pattern = '(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)(?:-(?P(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?' release_semver = re.match(semver_pattern, release_tag) @@ -69,6 +72,7 @@ jobs: else: raise ValueError(f"current version {current_version} is not greater than latest release {release_tag}") + with open(os.getenv("GITHUB_ENV"), 'a') as out_env: out_env.write(f"VERSION={docs_version}\n") out_env.write(f"ALIAS={docs_alias}\n")