Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 2

Markdown in "git tag" message not rendered in Release

Solved! Go to Solution.

Hi folks, I'm tagging my annotated git releases as follows:

git tag -a v0.4 -m "$(cat RELNOTES.md)"

The RELNOTES.md actually has a markdown, listing tag header + message body:

krew v0.3

Installation
------------
To install this release, refer to the [installation instructions](https://www.example.com)

Acknowledgements
----------------
Thanks to contributors for helping out in this release:
- The Dog
- Good cat

So when I push the tag to my repo, GitHub doesn't automatically create a release (expected).

 

What's weird is that when I go to Releases --> Tags of my repository and click "Create Release", I'm presented with a form with empty release header + message (unexpected):image.png

 

Next, I click Publish Release, without filling out these fields, and my release is created. However, the release body is not shown as Markdown (unexpected), but plaintext:image.png

 

Now if I click "Edit Release" and copy/paste the same markdown tag message into the Release message, it renders Markdown as expected.

 

So my question is, how are people supposed to convert annotated git tag messages into GitHub Release message body without doing manual work?

 

 

 

1 Reply
Highlighted
Solution
Community Manager
Message 2 of 2

Re: Markdown in "git tag" message not rendered in Release

The process that you're using copies the contents of a Markdown file into the text attribute of an annotated Git tag. There's nothing that indicates to GitHub that the contents of that text string are anything other than plain text. So yes, if you do nothing, GitHub uses the annotation as the release notes as plain text. But if you edit the release notes in a field that explicitly supports Markdown, it assumes that you're using Markdown and does the proper translation.

 

If you want to automate the process of having a GitHub release object with Markdown release notes, you could write a script to create the release object storing the release notes in the `body` field via the GitHub API.

 

I hope that helps!