Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(workflows) fix prev_tag script #1636

Merged
merged 1 commit into from
Jan 17, 2024
Merged

fix(workflows) fix prev_tag script #1636

merged 1 commit into from
Jan 17, 2024

Conversation

Oleksiivanov
Copy link
Contributor

@Oleksiivanov Oleksiivanov commented Jan 8, 2024

Overview

This PR introduces significant enhancements to the existing script used for determining previous version tags in a Git repository. The script efficiently handles various tag formats, including normal versions, release candidates (RC), and alpha versions. It is utilized in our release workflow, as detailed in RELEASE.yaml.

The script's primary purpose is to identify the previous tag for generating a changelog after each release. The previous version of this script was not functioning correctly, leading to inaccuracies in the changelog generation process. This update addresses those issues, ensuring more reliable and accurate output.

Rules for Determining Previous Tags

Normal Versions:

  • For a regular release within a minor version (e.g., 8.3.3), the previous tag is the next lower tag in the same minor series (e.g., 8.3.2).
  • When it's the first release of a new minor version (e.g., 8.4.0), the previous tag is the base (x.0) tag of the preceding minor version (e.g., 8.3.0).

Release Candidates (RC) for Normal Versions:

  • For the first RC of a new minor version (e.g., 8.4.0-rc1), the previous tag is the base (x.0) tag of the preceding minor version (e.g., 8.3.0).
  • For subsequent RC releases within the same minor version, the previous tag is the same as the previous RC release (e.g., 8.4.0-rc2).

Alpha Versions:

  • When it's the first alpha release of a new minor version (e.g., 8.4.0-alpha1), the previous tag is the base (x.0) tag of the preceding minor version (e.g., 8.3.0).
  • For subsequent alpha releases within the same minor version, the previous tag is the same as the previous alpha release (e.g., 8.4.2-alpha2).

Release Candidates (RC) for Alpha Versions:

  • For RC releases of alpha versions (e.g., 8.4.0-alpha2-rc1), the previous tag is the corresponding alpha tag (e.g., 8.4.0-alpha1).

Major Version Releases:

  • For the first release of a new major version (e.g., 9.0.0), the previous tag is the base (x.0) tag of the highest minor version from the last major series (e.g., 8.9.0).

Release Candidates (RC) for Major Versions:

  • For RC releases of a major version (e.g., 9.0.0-rc1), the previous tag is the base (x.0) tag of the highest minor version from the last major series (e.g., 8.9.0).

Examples:

Normal Versions:

  • For 8.4.0, the previous tag is 8.3.0.
  • For 8.3.3, the previous tag is 8.3.2.
  • For 8.3.1, the previous tag is 8.3.0.

Release Candidates (RC) for Normal Versions:

  • For 8.4.0-rc1, the previous tag is 8.3.0.
  • For 8.4.0-rc2, the previous tag is 8.4.0-rc1.

Alpha Versions:

  • For 8.4.0-alpha1, the previous tag is 8.3.0.
  • For 8.4.2-alpha2, the previous tag is 8.4.2-alpha1.

Release Candidates (RC) for Alpha Versions:

  • For 8.4.0-alpha2-rc1, the previous tag is 8.4.0-alpha1.
  • For 8.4.0-alpha1-rc1, the previous tag is 8.3.0.

Major Version Releases:

  • For 9.0.0, the previous tag is 8.9.0.
  • For 9.1.0, the previous tag is 9.0.0.

Release Candidates (RC) for Major Versions:

  • For 9.0.0-rc1, the previous tag is 8.9.0.

Invalid Tag Format:

  • For an invalid tag format (e.g., "invalid-tag"), the script outputs "Release tag is invalid."

Incomplete Tag:

  • For an incomplete tag (e.g., "8.4"), the script outputs "Release tag is invalid."

Test Results :

Test passed for input 8.4.0: Expected and got 8.3.0
Test passed for input 8.3.0: Expected and got 8.2.0
Test passed for input 8.3.3: Expected and got 8.3.2
Test passed for input 8.3.1: Expected and got 8.3.0
Test passed for input 8.4.0-alpha2: Expected and got 8.4.0-alpha1
Test passed for input 8.3.0-alpha1: Expected and got 8.2.0
Test passed for input 8.4.0-alpha2-rc3: Expected and got 8.4.0-alpha2-rc2
Test passed for input 8.4.0-alpha2-rc2: Expected and got 8.4.0-alpha2-rc1
Test passed for input 8.4.0-alpha2-rc1: Expected and got 8.4.0-alpha1
Test passed for input 9.0.0-alpha2-rc1: Expected and got 9.0.0-alpha1
Test passed for input 9.0.0-alpha3-rc1: Expected and got 9.0.0-alpha2
Test passed for input 8.4.0-alpha1: Expected and got 8.3.0
Test passed for input 8.4.1-alpha1: Expected and got 8.4.0
Test passed for input 8.4.2-alpha1: Expected and got 8.4.1
Test passed for input 8.3.2-rc1: Expected and got 8.3.1
Test passed for input 8.3.2-rc2: Expected and got 8.3.2-rc1
Test passed for input 8.3.2-rc5: Expected and got 8.3.2-rc2
Test passed for input 8.4.0-rc1: Expected and got 8.3.0
Test passed for input 8.4.0-rc2: Expected and got 8.4.0-rc1
Test passed for input 8.4.0-rc3: Expected and got 8.4.0-rc2
Test passed for input 8.4.0-alpha2: Expected and got 8.4.0-alpha1
Test passed for input 9.0.0: Expected and got 8.4.0
Test passed for input 9.1.0: Expected and got 9.0.0
Test passed for input 9.2.0-alpha2: Expected and got 9.1.0
Test passed for input 9.2.0-rc2: Expected and got 9.1.0
Test passed for input 8.2.0: Expected and got 7.4.0
Test passed for input 7.4.0: Expected and got 0.23.2
Test passed for input 0.23.2: Expected and got 0.11.0
Test passed for input 0.11.0: Expected and got 0.7.3
Test passed for input 0.7.3: Expected and got 0.5.1
Test passed for input 12.0.0: Expected and got 11.2.0
Test passed for input 15.0.0: Expected and got 12.2.0
Test passed for input 15.0.0-rc1: Expected and got 12.2.0
Test passed for input 15.0.3-rc2: Expected and got 5.0.0
Test passed for input 16.0.0-rc2: Expected and got 15.0.0
Test passed for input 19.0.0-alpha3: Expected and got 15.0.0
Test passed for input 19.0.3-alpha3: Expected and got 15.0.0
Test passed for input 19.0.3-rc3: Expected and got 15.0.0
Test passed for input 19.0.4-alpha11: Expected and got 19.0.4-alpha6
Test passed for input 20.3.1-alpha5: Expected and got 20.3.1-alpha2
Test passed for input 20.3.1-alpha23: Expected and got 20.3.1-alpha11
Test passed for input 20.4.1-alpha1-rc20: Expected and got 20.4.1-alpha1-rc11
Test passed for input 20.4.1-alpha1-rc11: Expected and got 20.4.1-alpha1-rc3
Test passed for input 20.4.1-alpha1-rc3: Expected and got 20.3.0
Test passed for input 20.4.1-alpha30-rc1: Expected and got 20.4.1-alpha11
Test passed for input 20.4.1-alpha2-rc1: Expected and got 20.3.0
Test passed for input invalid-tag: Expected and got Release tag is invalid
Test passed for input 8.4: Expected and got Release tag is invalid


Total tests passed: 48
Total tests fail: 0

@Oleksiivanov Oleksiivanov self-assigned this Jan 8, 2024
@Oleksiivanov Oleksiivanov marked this pull request as ready for review January 10, 2024 08:44
@Oleksiivanov Oleksiivanov requested a review from a team as a code owner January 10, 2024 08:44
@ev-codes
Copy link
Contributor

ev-codes commented Jan 10, 2024

Hi @Oleksiivanov ! Thanks for putting this together - I especially appreciate the tests you included [edit: and your thorough description of the tag definitions].

In the PR description, may you please explain:

  • what this script does, in a sentence or two
  • what problem the script solves
  • where this script will be used

That extra context would help me review the code better and would help future readers who might need to refer to this in future. Thanks :)

.github/workflows/scripts/prev_tag.sh Outdated Show resolved Hide resolved
.github/workflows/scripts/prev_tag.sh Outdated Show resolved Hide resolved
@Oleksiivanov Oleksiivanov marked this pull request as draft January 11, 2024 11:28
@Oleksiivanov Oleksiivanov force-pushed the fix-prev-tag-script branch 3 times, most recently from 883121e to 01eaa6f Compare January 16, 2024 14:04
@Oleksiivanov Oleksiivanov marked this pull request as ready for review January 16, 2024 14:21
@Oleksiivanov
Copy link
Contributor Author

Hi @Oleksiivanov ! Thanks for putting this together - I especially appreciate the tests you included [edit: and your thorough description of the tag definitions].

In the PR description, may you please explain:

  • what this script does, in a sentence or two
  • what problem the script solves
  • where this script will be used

That extra context would help me review the code better and would help future readers who might need to refer to this in future. Thanks :)

added Overview and test results to description

@Oleksiivanov Oleksiivanov requested a review from ev-codes January 16, 2024 14:31
@ev-codes
Copy link
Contributor

Thanks for your changes @Oleksiivanov, they look great!

@Oleksiivanov Oleksiivanov added this pull request to the merge queue Jan 17, 2024
Merged via the queue into main with commit 1d44eb1 Jan 17, 2024
4 checks passed
@Oleksiivanov Oleksiivanov deleted the fix-prev-tag-script branch January 17, 2024 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants