My git release script
I always had issues remembering how to create releases. So in order to standardise things, I wrote this script:
So whenever I am ready to release I would then just issue the command:
./ghrelease vX.Y.Z
Pre-requisistes:
You obviously need git
. But also you would need
github-cli.
Your repository must also be clean, without any pending commits.
You must be on the default branch (usually main
or
master
), unless doing a pre-release.
Optionally, you may have a wfscripts/checks
directory
containing checking scripts.
What happens on release
- remote
--tags
will be synchronised with local tags. - if a tag of the same name already exists then, release will be stopped.
- check if we are on the
default
branch (unless pre-release) - check if there are any uncomitted changes.
- If available,
wfscripts/checks
is run usingrun-parts
- Will create release notes based on log entries since the last release (previous annotated tagged commit)
VERSION
orversion.h
is updated and comitted.- A new annotated tag is created.
- Commits and tags are push to remote (origin).
- Release is created using
github-cli
.
Pre-releases
You can create pre-releases. These do not have to be on the
default branch. To do this use the --rc
(Release candidate)
option:
./ghrelease vX.Y.Z-rcN
This will create a release in github
but tag it as pre-release.
After release, you may delete all pre-release candidates:
./ghrelease --purge