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

gh release create --use-latest-tag #9395

Open
fregante opened this issue Jul 30, 2024 · 2 comments
Open

gh release create --use-latest-tag #9395

fregante opened this issue Jul 30, 2024 · 2 comments
Labels
enhancement a request to improve CLI gh-release relating to the gh release command needs-user-input

Comments

@fregante
Copy link

Describe the feature or problem you’d like to solve

In my npm publish workflow, I generate a version and tag via npm version minor and I want to reuse that last tag that was generated.

This currently requires first storing the output of npm version minor into a $VERSION env and then reusing it as gh release create $VERSION

Proposed solution

This seems redundant as usually I'd expect people to want to release the latest tag, if HEAD has already been tagged. gh release create does starts an interactive flow, so what do you think about:

gh release create --use-tagged-head

This will use the first tag found on HEAD. Alternative, if common and easy in git, it could use first tag found in reverse chronological order.

@fregante fregante added the enhancement a request to improve CLI label Jul 30, 2024
@cliAutomation cliAutomation added the needs-triage needs to be reviewed label Jul 30, 2024
@andyfeller andyfeller added the gh-release relating to the gh release command label Aug 5, 2024
@andyfeller
Copy link
Contributor

@fregante : Thanks for opening up this suggestion! Couple of questions to help understand the scope of this potential enhancement:

  1. Would this new flag resolve this tag against the local repository or those created on the GitHub.com side?
  2. What would happen if the tag was used by another release?

Looking at GitHub Actions workflows executing npm version, I'm not so confident to say the most people don't need this information for other aspects of their workflow. 🤔

@andyfeller andyfeller added needs-user-input and removed needs-triage needs to be reviewed labels Aug 5, 2024
@fregante
Copy link
Author

fregante commented Aug 5, 2024

Would this new flag resolve this tag against the local repository or those created on the GitHub.com side?

Good question. I don't know how gh-cli deals with these cases normally so I couldn't give an appropriate response. It wouldn't matter in my case since I could just push the tag first.

What would happen if the tag was used by another release?

The same that already happens when you call it twice:

gh release create 1.1.1
gh release create 1.1.1

Looking at GitHub Actions workflows executing npm version

It's not clear from that search, but any call you see followed by ${{ user input }} it also accepts keywords like patch, minor, major, prerelease, so they all fall into this (if they also used gh-cli.

Also, as prior art: sindresorhus/np#578

This tool can be used for the same purpose: it uses the "latest tag" to create a release draft: np --release-draft-only

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement a request to improve CLI gh-release relating to the gh release command needs-user-input
Projects
None yet
Development

No branches or pull requests

3 participants