zestsoftware / zest.releaser

Python software releasing made easy and repeatable
https://zestreleaser.readthedocs.io
GNU General Public License v2.0
198 stars 62 forks source link

Use the changelog to generate an better commit message (or annotated tag) #218

Open hgrecco opened 7 years ago

hgrecco commented 7 years ago

GitHub uses the commit information (or the tag annotation) to make the release notes (see for example, https://github.com/zestsoftware/zest.releaser/releases/tag/6.10)

It would be nice to take from the corresponding section from the change log and use it.

reinout commented 7 years ago

That seems like it would be relatively easy.

Is it just a matter of copy/pasting the changelog lines into the tag commit message?

hgrecco commented 7 years ago

It seems so according to what I see in my repo and https://help.github.com/articles/about-releases/

May be instead of having Tagging 0.6 we could have something like

Whats new in 0.6 (DATE)
-----------------------

<here goes the changelog>

The only thing I am not clear about is that if you are logged into github and go to https://github.com/YOUR_USERNAME/YOUR_REPO/tags you will see a link in the right hand side of the screen, next to each tag which says:

Add release notes (No release notes)

I am not clear how tag annotations interact with this feature or if there is a way to feed this part of github from a git commit/tag.

In any case, just the other part would be a nice improvement.

gforcada commented 9 months ago

🙌🏾 I was about to report this, and @hgrecco was faster than me for +6 years 😅

I'm also trying to automate getting the release notes from CHANGES.(rst|md) into GitHub releases, so far my script is as ugly as:

# get the lines where the changelog for the last release starts and finishes
first_line=$(grep -n "\-\-\-\-" CHANGES.rst | cut -d":" -f1 |head -n1)
last_line=$(grep -n "\-\-\-\-" CHANGES.rst | cut -d":" -f1 |head -n2 | tail -n1)

# do some math to adjust the line numbers
first=$((${first_line}+1))
last=$((${last_line}-2))
end=$((${last_line}-1))

# extract the changelog
sed -n "${first},${last}p;${end}q" CHANGES.rst > body.txt

# debug
cat body.txt

# actual release creation (so far with `-p` to mark them as pre-releases)
gh release create ${{ github.ref_name }} -p -F body.txt

The whole mambo-jumbo of grep/sed could be avoided if the annotated tag would have the changelog already on it.

Then all the above would only be:

gh release create ${{ github.ref_name }} --notes-from-tag

✨ 💫

How hard would it be to get the changelog on an annotated tag? 🤔 🤞🏾

gforcada commented 9 months ago

Turns out, after a bit of digging and testing, that the --notes-from-tag for the gh release create command is not looking at the commit message on the tag itself, but rather the commit where the tag belongs to 🤷🏾