python-package-template icon indicating copy to clipboard operation
python-package-template copied to clipboard

Add pre-release support

Open jenstroeger opened this issue 2 years ago • 4 comments

Currently

The release workflows support only final releases of a package, and no pre-releases. The branches support these release workflows by PR → staging branch → main branch, where a push to the main branch triggers building and publishing a final package release.

Proposal

We want to add support for building and publishing pre-releases of the package. To achieve that we can add the following workflows to the staging branch that trigger on push event:

  1. If the commit log shows a release will be build (i.e. there’s at least one fix: or feat: or breaking change) then
    1. Build all release artifacts; then
    2. Bump the package’s version using commitizen’s --prerelease option, e.g. using rc for release candidates, and push the new tag; then
    3. Create a pre-release on Github and attach the pre-release build artifacts.

We can probably refactor the current release.yaml into two workflows:

  1. release-rc.yaml that triggers on push to the staging branch and produces a pre-release; and
  2. release.yaml that (much like its current incarnation) triggers on push to the main branch and produces a final release,

both of which can make use of two new reusable workflows that

  • Build and bump a branch; and
  • Create a Github release and publish the artifacts.

For this to work, we also need the following two features available:

  • https://github.com/commitizen-tools/commitizen/pull/799
  • https://github.com/commitizen-tools/commitizen/pull/800

jenstroeger avatar May 06 '23 02:05 jenstroeger

After some tinkering with cz I think this feature needs to wait:

  • the Conventional Commits specification doesn’t actually state how to bump pre-releases, see issue https://github.com/conventional-commits/conventionalcommits.org/issues/398 (and this comment); and
  • commitizen doesn’t bump correctly (what is “correct” without spec, though), see issue https://github.com/commitizen-tools/commitizen/issues/688.

For reference, there’s also an interesting Discussion: pre-release versioning and PEP440 cross-compatibility.

jenstroeger avatar May 15 '23 20:05 jenstroeger

And just out: v1.6.0 of the SLSA Generator added support for pre-releases as well 👍🏼

jenstroeger avatar May 22 '23 05:05 jenstroeger

I think this would make sense if apart from the main and staging branches, there are additional ones for pre-releases.

behnazh avatar Sep 02 '23 07:09 behnazh

Commitizen v3.14.0 add support for pre-release bumps.

jenstroeger avatar Feb 08 '24 07:02 jenstroeger