Recently, I had a project at work running Semantic Release to manage releases. It was currently at v4.5.0
for the main
release channel and v4.0.0-next.22
for the next
prerelease channel.
Problem
Obviously, the prereleases were behind the main releases and I wanted our next stable release to be v5.0.0
and before that, have the prerelease to v5.0.0-next.1
.
I tried pushing the typical feat!: bump
commits, without success: Semantic Release just kept incrementing the next
part (ex.: v4.0.0-next.23
), and refused to increment the major version (to v5.0.0-next.1
) like I wanted.
Solution
To tackle this problem, I tried the following these steps:
- create an empty commit
feat: release v5.0.0-next.1
- create a tag
v5.0.0-next.1
to point to that commit - create a prerelease on GitHub to point to that tag
But when pushing everything to GitHub, Semantic Release would still fail (the tag v5.0.0-next.1
already existed). And if I deleted the tag again, Semantic Release would revert to its behaviour of increment the next part (v4.0.0-next.23
).
The solution to avoid this was to update the notes for Semantic Release accordingly after creating the v5.0.0-next.1
tag:
I found this tip by looking at the docs (though these commands are listed as a solution for a different issue).
This is obviously a dangerous action, but when done correctly, it can get you out of a bind!
- Versioning
- Semantic Release
- Git