Closed j-i-l closed 3 months ago
I followed your instructions and closed the pull request, but now the CHANGELOG does not look like it was on the release branch that I checked out....
I followed your instructions and closed the pull request, but now the CHANGELOG does not look like it was on the release branch that I checked out....
In the pull request it looks like there is only 1 single commit in the release-...
branch that contains the automatically generated content from chglog
. Could it be that you forgot to push the changes back to GitHub before merging?
I'll clean up this release and then and we can do it again with 1.0.1-rc2
locally you should run
git tag -d 1.0.1
as otherwise, when you use git push --tags
next time, it will push this tag back to GitHub.
So, I did git tag -a 1.0.1-rc -s -m 'Better development environment'
but I realised that I forgot to pull the lastest main. So then I did git pull
and git tag -a 1.0.1-rc1 -s -m 'Better development environment'
. Then git push --tags
.
It created the pull request and I checked the changelog on the release branch and it was like what you suggested above.
Ok, things are set back again.
So, I did
git tag -a 1.0.1-rc -s -m 'Better development environment'
but I realised that I forgot to pull the lastest main. So then I didgit pull
andgit tag -a 1.0.1-rc1 -s -m 'Better development environment'
. Thengit push --tags
. It created the pull request and I checked the changelog on the release branch and it was like what you suggested above.
Oh, I see now: I had just played it through once yesterday, and thus there already was a branch release-1.0.1
in which I had edited the CHANGELOG.md file manually. When you pushed your tags, the branch release-1.0.1
was set to the new status on GitHub, but what you saw on your machine might still have been my version from yesterday. Usually you would not already have a branch with the same name locally, so in order to get the branch from the pull request you would have to do a git fetch origin
followed by a git checkout release-...
first to get the latest state of this branch from GH.
You can play it through again with 1.0.1-rc2
and when you fetch the release-1.0.1
branch from GitHub the CHANGELOG should contain these lines listing the merge requests and not the content I suggested above. If you still see my edits then do a git pull
and you should get the version from GH.
Once this is sorted out we have the release, versioning, ci/cd for testing and linting and the automatic docs all set up and I'll focus on the actual code again.
Ok. I had to to a git pull because I was still seeing your changelog. and I get:
❯ git pull
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 1), reused 3 (delta 1), pack-reused 0 (from 0)
Unpacking objects: 100% (3/3), 624 bytes | 624.00 KiB/s, done.
From github.com:alexbovet/flow_stability
+ f82cc0a...151f0df release-1.0.1 -> origin/release-1.0.1 (forced update)
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint:
hint: git config pull.rebase false # merge
hint: git config pull.rebase true # rebase
hint: git config pull.ff only # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: Need to specify how to reconcile divergent branches.
You just need to update the local branch and git wants to know how. If you have no local changes do merge 'git merge --ff-only' and you should be good to go. If not, I would just delete the local branch and get the one from GH, so:
git branch -D release-1.0.1
And then fetch from origin and checkout the remote branch again.
Done! :-)
Now we have the release pipeline set up, we can easily create new releases.
All you need to do is publish a new tag following the semver convention for a release candidate. In our case we could release version
1.0.1
containing some bug fixes and "meta" features (documentation, testing, linting, ...).To do so, simply checkout
main
locally and type (for example):Note1: The
-s
is for signing the tag and can simply be omitted. Note2: You could also write1.0.1-rc1
or1.0.1-rc20
if this is the 20th attempt to publish version1.0.1
.Then head over to our Pull Requests and wait for a new Pull request to pop-up, called
Release version 1.0.1
or so.If you inspect the changes in this pull request, you will see that it added some lines to the CHANGELOG file. If fact it uses chglog and tries to automatically extract changes from commit messages since the last tag. You might start a commit message with
feat:
orfix:
and chglog will pick this up. The relevant config for this can be found in the ./.chglog folder of the repository. I honestly never managed to adhere to these "tags" in commit messages, I'm also not a fan of encoding things in the commit message, so I edit the CHANGELOG.md file in the Pull Request of a new release.To do so checkout the branch that was created for the pull request (it's called
release-1.0.1
or so) and adapt the CHANGELOG.md file (and other files) to your liking.Here is what I would add to the CHANGELOG.md for this particular release:
...(keep the heading unchanged as it will be parsed for the release message later)
Bug Fixes
numpy
2.0 #28Meta Features
...(keep older changes unchanged)
I'd basically go through the closed issues and mention what might be of interest
If you are happy with the state of the CHANGELOG.md file simply merge the Pull Request. After a while you will see a new tag with the cleaned version
1.0.1
(so the-rc...
is gone) and there will also pop up a new release.DONE! :rocket: You've just published a new release!
Note: These
release-X.Y.Z
branches are particular in the sense that we do generally not want to update them with new content ofmain
before merging them. The reason for this is simple:release-...
branches are here to prepare release of a particular state ofmain
that we set when we set theX.Y.Z-rc
tag. Ifmain
changes then it is likely that a new fix, feature or breaking change were introduced which, according to the semver standard should lead to a version increase, thus we should simply create a new release candidateX,Y+1,Z-rc
(e.g. new feature) rather than mergingmain
into therelease-X.Y.Z
branch. We still want to merge therelease-X.Y.Z
branch intomain
eventually though: It contains changes (like the edits of CHANGELOG.md) that we want to push pack tomain
.What happens when you merge this
Release version ...
pull request is this:release-X.Y.Z
branch gets the cleaned tagX.Y.Z
main
is moved forward to this merge commitSo what is published is the state of
main
when theX.Y.Z-rc
tag was created (plus edits to the CHANGELOG.md, etc. that were made in therelease-X.Y.Z
branch).