Skip to content

Conversation

@moelsayed
Copy link
Contributor

What this PR does / why we need it:
Add release github action
Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Release note:

Copy link
Contributor

@Diaphteiros Diaphteiros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recently started a discussion about how we want our versioning to work in the internal slack (will send you a link). Quickly summarized, I would like the VERSION file to contain a -dev suffix except for release commits, where the suffix is removed.

To get the actual version, don't do cat VERSION, but instead hack/get-version.sh. The logic in that file should work like this: If the VERSION file does not have the -dev suffix, return its content as is. Otherwise, append the current commit's hash (git rev-parse HEAD), so that the final version looks like v1.2.3-dev-abcdef.
For the purpose of this GHA, cat VERSION is actually fine, because it is not interested in the actual version unless it is a release version, in which case the output of cat VERSION and hack/get-version.sh is the same. See below for further explanation.

The trigger for a release should then be that the VERSION file was changed and its content does not end in -dev. While your current version check would do that, it would also always exit with exit code 1, causing the action to be marked as failed. Please adapt this so that a version v1.2.3-dev in the VERSION file does not create a release, but also does not cause the pipeline to fail.

For this logic to work, an additional step is needed: After a successful release, the action has to push a commit which appends the -dev suffix to the content in the VERSION file again.

Example 1: no release

  • Check VERSION file (v1.2.3-dev).
    • hack/get-version.sh would return something like v1.2.3-dev-abcdef.
  • Content ends with -dev.
  • => This is a dev version, no release required. Actions ends with exit code 0.

Example 2: release

  • Check VERSION file (v1.3.0).
    • hack/get-version.sh would return v1.3.0.
  • Content does not have the -dev suffix.
  • Create a release for the current version.
  • Create and push a commit appending the -dev suffix.
    • The VERSION file now contains v1.3.0-dev and hack/get-version.sh returns something like v1.2.3-dev-abcdef.
    • The commit message can be something like preparing next dev cycle <version>.

Unless there are any objections, could you please modify the GHA accordingly?

@Diaphteiros
Copy link
Contributor

Small addition regarding the reasoning behind my proposal:

It helps with development if one can easily differentiate between dev and release versions. If all scripts use the value from hack/get-version.sh (the GHA being an exception, as explained above), I can easily run something like make image and my image will be tagged with a version containing the last commit's hash, which makes it unique. Otherwise, my dev image would be tagged with the version of the last release, which makes it hard to differentiate from the actual image of the last release, potentially causing unnecessary confusion (or accidentally overwriting the actual release image with a dev version in the worst case scenario).

Copy link
Contributor

@Diaphteiros Diaphteiros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it!

@moelsayed moelsayed merged commit 9eb56f0 into main Feb 26, 2025
5 checks passed
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.

3 participants