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

semver tag : allow outputing build information (part after plus) #384

Open
Murazaki opened this issue Feb 10, 2024 · 4 comments · May be fixed by #385
Open

semver tag : allow outputing build information (part after plus) #384

Murazaki opened this issue Feb 10, 2024 · 4 comments · May be fixed by #385

Comments

@Murazaki
Copy link

Description

Please allow outputting "+" prefixed information in semver tags, as some of us uses it for fork versioning.

@Murazaki Murazaki changed the title semver tag : allow ouputing build information (part after plus) semver tag : allow outputing build information (part after plus) Feb 10, 2024
@crazy-max
Copy link
Member

Can you show an example of versioning? It should be compliant with https://semver.org/

@Murazaki
Copy link
Author

I'm working on a fork.
The upstream has a base semver version : 2.3.8 (git tag v2.3.8)
My fork adds on top of that : 2.3.8+fork.1.0.1 (git tag v2.3.8+fork.1.0.1)
Type=semver gives a build tag like this : 2.3.8

It would be better to be able to show that particular info in the docker tag : 2.3.8+fork.1.0.1

Of course it doesn't need to be default, and it can be on a per name basis. I was envisioning a variable addBuildInfo=<true|false> or addBuildInfo=<nameToPickUp> (for instance addBuildInfo=fork)

@crazy-max
Copy link
Member

Thanks for your feedback. I don't think we need an extra variable, build metadata for semver should be included whatever the case.

@Murazaki
Copy link
Author

Murazaki commented Feb 13, 2024

Thanks for taking that into account.

I was looking at the code and I can see some choices have been made either in metadata-action or in semver that made it a bit difficult to add prerelease and build values with handlebars. I was looking into ways to make those available with helpers, here is what I came up with (there's still an issue on the type of the entry data, register might happen at the wrong time)

    handlebars.registerHelper("prereleaseMetadata", function () {
      return (this.prerelease ? "-" + this.prerelease.join(".") : "");
    });
    
    handlebars.registerHelper("buildMetadata", function () {
      return (this.build ? "+" + this.build.join(".") : "");
    });
    
    handlebars.registerHelper("completeVersion", function () {
      return (
        [this.major, this.minor, this.patch].join(".") +
        (this.prerelease ? "-" + this.prerelease.join(".") : "") +
        (this.build ? "+" + this.build.join(".") : "")
      );
    });

I put the changes in a branch, but I'm still working on adding a handlebar environment around that.
https://github.com/Murazaki/metadata-action/tree/feature/semver-supplementary-data

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

Successfully merging a pull request may close this issue.

2 participants