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

Support annotated git tags in hub release #2247

Open
kurko opened this issue Aug 28, 2019 · 4 comments
Open

Support annotated git tags in hub release #2247

kurko opened this issue Aug 28, 2019 · 4 comments
Labels

Comments

@kurko
Copy link

kurko commented Aug 28, 2019

Is it possible to have hub release create [TAG] use the same message as the referenced tag? I don't want it to open the editor for me to add a message when I already added a tag.

I imagine I can create a sub script to load the tag message and then use hub release create -m $tag-message, but is there any chance this feature already exists and I couldn't find it?

@mislav mislav added the feature label Sep 3, 2019
@mislav
Copy link
Owner

mislav commented Sep 3, 2019

Hi thank you for your suggestion! To clarify: are you talking about annotated git tags, and your proposed flow would be that hub release create TAG would re-use the title and message from the annotated tag without opening the editor?

Would you be open to the idea that hub would instead pre-populate the contents of the text editor with the message from the git tag, but still open the text editor unless you passed some flag such as --no-edit? The reason I suggest this is that I think it would be confusing that hub release create sometimes opens the text editor, and sometimes not.

@kurko
Copy link
Author

kurko commented Sep 3, 2019

Yes, annotated git tags. As you probably know, Github Releases doesn't generate annotated tags (nor does it gives us options to do so). To use annotated tags, then, I tag manually.

At the end of the process, I have to copy/paste the tag title/message, manually open Github Releases and create a new one based on the recently pushed annotated tag. Having the possibility of the Release feature with tag's title/message automatically would help automate this process. There are more people around the web with the same problem.

Would you be open to the idea that hub would instead pre-populate the contents of the text editor with the message from the git tag, but still open the text editor unless you passed some flag such as --no-edit?

Yes, absolutely. I totally understand the UX concerns and I agree, it needs to be coherent. In my use case, though, I would only use --no-edit and I'd probably only use the editor when manually calling hub.

p.s.: for context, I currently run a bin/release script I created which will form release notes based on past commits and then create an annotated tag (among other things) with it as message. If hub created annotated tags, I'd probably bypass the git tag part entirely and just use hub standalone.

@mislav
Copy link
Owner

mislav commented Sep 4, 2019

To programatically create a GitHub Release by reusing the subject & body of an annotated git tag:

git for-each-ref --format="%(subject)%0a%0a%(body)" refs/tags/<TAG> | \
  hub release create -F- <TAG>

This assumes that the tag was already pushed to the remote. You could incorporate this into your release process.

I agree that this is unwieldy. I'll keep this issue open as a todo item to explore how hub could better support annotated tags. Thank you for the suggestion!

@mislav mislav changed the title hub release create message equal to respective tag message Support annotated git tags in hub release Sep 4, 2019
@DrSensor
Copy link

DrSensor commented Sep 29, 2019

Just want to add another alternative to the list

This utilize git tag --list. For example:

TAG=${GITHUB_REF##*/} # in case you use it in github action

git tag --list ${TAG} --format='%(contents:subject)%0a%0a%(contents:body)' | hub release create --draft -F- ${TAG}

Note that instead of using %(subject)%0a%0a%(body), it's better to write it as %(contents:subject)%0a%0a%(contents:body) to avoid printing PGP SIGNATURE in case the tag is signed. This behavior also found on git for-each-ref.

DrSensor added a commit to DrSensor/scdlang-vscode that referenced this issue Sep 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants