From 51abc0ccc29031016080cbb871572ef88885e8fd Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 24 Jun 2024 13:21:04 -0700 Subject: [PATCH 1/4] update from main --- .github/scripts/get_next_release_version.py | 51 +++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/scripts/get_next_release_version.py diff --git a/.github/scripts/get_next_release_version.py b/.github/scripts/get_next_release_version.py new file mode 100644 index 0000000..15e15d8 --- /dev/null +++ b/.github/scripts/get_next_release_version.py @@ -0,0 +1,51 @@ +import argparse +import re + +from semantic_version import Version +from typing import List + + +def increment_latest_version(released_versions: List[str], target_version: str) -> Version: + """Retrieve the latest version matching the major.minor and release stage + semantic version if it exists. Ignores the patch version. + + Args: + released_versions (List[str]): List of semantic versions (1.0.0.0rc, 2.3.5) to match against + target_version (str): semantic version (1.0.0.0rc, 2.3.5) to match against + + Returns: + Version: The latest version. + """ + target_version = Version.coerce(target_version) + latest_version = target_version + latest_version.prerelease = ("build0",) + for version in released_versions: + version = Version.coerce(version) + if ( + version.major == latest_version.major + and version.minor == latest_version.minor + and version.patch == latest_version.patch + and version.prerelease > latest_version.prerelease + ): + latest_version = version + + next_pre = re.sub(r"\d+", lambda x: str(int(x.group()) + 1), latest_version.prerelease[0]) + latest_version.prerelease = (next_pre,) + latest_version.build = [] + + return latest_version + + +def main(): + parser = argparse.ArgumentParser(description="Get the next release version") + parser.add_argument("--released_versions", nargs="+", help="List of released versions") + parser.add_argument("--target_version", help="Target version to compare against") + args = parser.parse_args() + released_versions = args.released_versions + target_version = args.target_version + latest_version = increment_latest_version(released_versions, target_version) + print(latest_version) + + +if __name__ == "__main__": + main() From 2ca186e3f13ff893d15d9c320f6f0c8d0aef53c9 Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 2 Dec 2024 11:42:09 -0800 Subject: [PATCH 2/4] remove spark exception --- .github/workflows/release-prep.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/release-prep.yml b/.github/workflows/release-prep.yml index a03c1e8..47788db 100644 --- a/.github/workflows/release-prep.yml +++ b/.github/workflows/release-prep.yml @@ -215,17 +215,6 @@ jobs: fi echo "::notice title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" - - name: "Spark safety check" - if: ${{ contains(github.repository, 'dbt-labs/dbt-spark') }} - run: | - if [[ ${{ steps.version-check.outputs.up_to_date }} != true ]] - then - title="Spark version-bump.yml check" - message="dbt-spark needs version-bump.yml run before running the release. The version bump is not up to date." - echo "::error title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" - exit 1 - fi - - name: "[DEBUG] Print Outputs" run: | echo up_to_date: ${{ steps.version-check.outputs.up_to_date }} From 9a2bdc4879e463f667e6fbc1dbb2537bde0d5a29 Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 2 Dec 2024 11:49:19 -0800 Subject: [PATCH 3/4] remove spark exception --- .github/workflows/release-prep.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/release-prep.yml b/.github/workflows/release-prep.yml index 47788db..f3bc77d 100644 --- a/.github/workflows/release-prep.yml +++ b/.github/workflows/release-prep.yml @@ -163,17 +163,6 @@ jobs: fi echo "::notice title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" - - name: "Spark safety check" - if: ${{ contains(github.repository, 'dbt-labs/dbt-spark') }} - run: | - if [[ ${{ steps.set_existence.outputs.exists }} != true ]] - then - title="Spark version-bump.yml check" - message="dbt-spark needs version-bump.yml run before running the release. The changelog is not up to date." - echo "::error title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" - exit 1 - fi - - name: "[DEBUG] Print Outputs" run: | echo changelog_path: ${{ steps.set_path.outputs.changelog_path }} From 4341e3d23def0f1d3cc3f53399668e58bf6071b1 Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 3 Dec 2024 08:12:23 -0800 Subject: [PATCH 4/4] remove old script file --- .github/scripts/get_next_release_version.py | 51 --------------------- 1 file changed, 51 deletions(-) delete mode 100644 .github/scripts/get_next_release_version.py diff --git a/.github/scripts/get_next_release_version.py b/.github/scripts/get_next_release_version.py deleted file mode 100644 index 15e15d8..0000000 --- a/.github/scripts/get_next_release_version.py +++ /dev/null @@ -1,51 +0,0 @@ -import argparse -import re - -from semantic_version import Version -from typing import List - - -def increment_latest_version(released_versions: List[str], target_version: str) -> Version: - """Retrieve the latest version matching the major.minor and release stage - semantic version if it exists. Ignores the patch version. - - Args: - released_versions (List[str]): List of semantic versions (1.0.0.0rc, 2.3.5) to match against - target_version (str): semantic version (1.0.0.0rc, 2.3.5) to match against - - Returns: - Version: The latest version. - """ - target_version = Version.coerce(target_version) - latest_version = target_version - latest_version.prerelease = ("build0",) - for version in released_versions: - version = Version.coerce(version) - if ( - version.major == latest_version.major - and version.minor == latest_version.minor - and version.patch == latest_version.patch - and version.prerelease > latest_version.prerelease - ): - latest_version = version - - next_pre = re.sub(r"\d+", lambda x: str(int(x.group()) + 1), latest_version.prerelease[0]) - latest_version.prerelease = (next_pre,) - latest_version.build = [] - - return latest_version - - -def main(): - parser = argparse.ArgumentParser(description="Get the next release version") - parser.add_argument("--released_versions", nargs="+", help="List of released versions") - parser.add_argument("--target_version", help="Target version to compare against") - args = parser.parse_args() - released_versions = args.released_versions - target_version = args.target_version - latest_version = increment_latest_version(released_versions, target_version) - print(latest_version) - - -if __name__ == "__main__": - main()