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

Automatically Tag Latest Official Version with 'latest' in Docker Repository Based on Semantic Versioning #407

Open
Gezi-lzq opened this issue Apr 30, 2024 · 1 comment

Comments

@Gezi-lzq
Copy link

Gezi-lzq commented Apr 30, 2024

Feature Request

Problem Statement

Our current release process does not automatically adjust the latest tag to the most recent official version based on semantic versioning. This limitation arises from our unique git workflow, where:

  • Official versions are not strictly confined to the main branch.
  • Version releases do not always follow a sequential temporal order.
    Given these constraints, we seek a feature that, upon releasing an image triggered by a tag, checks if the tag adheres to the Semantic Versioning (SemVer) standard and represents the highest version within the repository. If both conditions are met, the image should additionally be tagged as latest.

Proposed Solution

  1. Detects when a release is triggered by a tag.
  2. Verifies that the tag follows the SemVer standard.
  3. Compares the tagged version against all existing versions in the repository to determine if it is the highest.
  4. If the tagged version is the highest based on SemVer, automatically tags the image with latest.
[Tag Release] ---> [Check if SemVer] ---> [Compare Versions] ---> [Is highest version?] ---> [Tag as 'latest']

(We have not found existing documentation or capabilities within our current toolset that meet this specific need.Additionally, I'm unsure if my idea above constitutes a valid requirement. I would appreciate some feedback on its viability. If deemed reasonable, I'm willing to implement this feature.)

@crazy-max
Copy link
Member

Compares the tagged version against all existing versions in the repository to determine if it is the highest.

I wonder why you would need this at all? I guess you maintain n and n-1 versions of your project or more right? Such as v1.9.0 patch releases and v1.10.0. In such case you could just have an env in your workflow that would be the latest version digits like:

env:
  LATEST_VERSION: v1.10

And then you could just compare any tag to it by using semver comparison with https://github.com/npm/node-semver and https://github.com/actions/github-script in a dedicated step to set latest as new env for the metadata-action.

Or I guess this would be fine to create a new global expression to handle this and remove extra overhead in your workflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants