kraftbj and matticbot changelogger: Fix version next when current version is a prerelease…
a6c8923 Oct 12, 2021
changelogger: Fix `version next` when current version is a prerelease…
… (#21384)

* changelogger: Fix `version next` when current version is a prerelease

Currently, if the current version in the changelog is "1.2.3-alpha",
a patch bump would want the next version to be "1.2.4" where a user
would probably expect to be releasing "1.2.3". It's even worse if you
pass say `--prerelease=alpha.2`, it would want to go to to
"1.2.4-alpha.2" instead of "1.2.3-alpha.2".

So, let's DWIM here: If the latest version is a prerelease, find the
most recent non-prelease version and bump that instead. But if it turns
out that produces something less then the actual current version, try
just updating the prerelease of the current version. And if that too is
less (e.g. "1.2.3-beta" with --prerelease=alpha), then do a patch bump
from the current version.

Unfortunately to do this we need to update the VersioningPlugin
interface to provide a way to do "just updating the prerelease of the
current version", which makes for a major version bump. Sigh.

* Bump all the versions!

* Need to fix `changelogger write` too

* Add tooling for weekly Atomic releases (#21385)

* Add tooling for weekly Atomic releases

After much discussion (p1634048495196700-slack-C01U2KGS2PQ), we've
decided that the weekly Atomic releases for Jetpack should be versioned
like "10.3-a.1", "10.3-a.3", and so on (odd numbers), while the master
alpha versions should be like "10.3-a.0", "10.3-a.2", and so on.

This updates the tooling to make that happen. In several places we need
to decide whether to pass `--prerelease=alpha` or `--prerelease=a.0` to
changelogger, and `changelogger-release.sh` needs to have a flag to
specify that one of these Atomic releases is being created.

* Fix tests

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/1334961501
a6c8923