New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for alternative workflows #528
Comments
Hoping this will help with workflows like in crate-ci#528
FYI I'd recommend also checking out #119 as it discusses an alternative workflow |
While I will step through to see how cargo-release can help, I think being too strict on what/who can push can end up causing more pain to the process than it is worth and I'd recommend re-evaluating that stance.
With 0.22 out, you can use $ cargo release changes # review changes to choose versions
$ cargo release version patch # update versions including in dependents
$ ./prepare.sh # call `cargo release replace` and `cargo release commit` as needed Then once merged $ cargo release tag --workspace # will automatically skip existing tags
$ cargo release push --workspace # will push the tags
$ cargo release publish --workspace # will automatically skip existing published In #119, I discuss a I left out What this buys you over doing it by hand
|
Why does |
Because between forking off the release preparation branch and the merge of the same, another PR could be merged that introduces new functionality, bugs, etc.: gitGraph
commit
branch release
checkout release
commit id:"release preparation"
checkout main
branch feature
checkout feature
commit id:"new feature"
checkout main
merge feature
merge release tag:"v0.1.0"
I will have a look at the other points you mentioned, thanks! 👍 |
Oh right, you would be tagging and publishing |
I had a look at
cargo-release
and found that it does only support one workflow (please correct me if I'm wrong).Current workflow
From what I see, the workflow for using
cargo-release
is that I have to be on my main branch (cargo-release
checks that) and I do a release from there.cargo-release
then does pre-release steps (clearing up the changelog file, setting the right version strings), then does the release (cargo-publish
) and tag that commit appropriately. After that, it does some post-release steps (bump versions). Then, these commits and tags are pushed to the remote repository.Please correct me if anything from above is not correct.
Desired workflow
I currently use workflows that do not support committing to the main branch at all and actually pushing changes to "main" is forbidden on all my repositories. I exclusively use bors for merging to
main
/master
!There are two scenarios:
Small projects
For "small projects" (few contributors, less frequent merges to main) I branch off of "main" and create a "prepare-x.y.z" branch (where "x.y.z" is acutually the version of the release about to be created), that prepares for the next release. I update the changelog (by hand for now, but I plan on implementing
cargo-changelog
soon), update version strings in README, examples, Cargo.toml if needed. I push that out as a normal PR to github and wait for CI to be green.I merge using bors. Bors is the only actor that is allowed to push to my main branch in any case.
Once bors merged, I forward my local main branch to that merge commit, create a tag, do
cargo-publish
and push out that tag.Big Projects
For big projects, I am going to use a more sophisticated workflow (I did not yet get the chance to actually use that workflow, but it has been discussed among my peers and it looks like we want to go with exactly that workflow).
The overall idea of that workflow is that
main
does never slow down. With the "Small projects" workflow from above, I do not merge changes tomain
between the branch-off of the "prepare" branch and its merge. With this workflow, merging tomain
is never forbidden or even delayed for one second.For this workflow, I create a
release-1.2.x
branch (normally patchlevel is set to the string "x" because patch-releases will happen on that release branch) on a commit onmain
. Becausemain
has to be always green, it does not matter which one.That
release-1.2.x
branch is directly protected on github. Nobody is allowed to push to that branch, except for the merge bot (bors).I then create a PR to that
release-1.2.x
branch for consolidating the changelog. Once that is merged, I go to that merge commit and create a tag and do acargo-publish
just like above.To visualize (I left out progress on
main
because that would make the diagram even more complicated):Once the release is done, the commits for consolidating the changelog (and others, if any) are cherry-picked to PRs for
main
, to backport these patches to the main development branch.Also, a PR is opened for
main
to update the version number (minor version) for the next release.To visualize based on the diagram from above (I left out progress on
main
because that would make the diagram even more complicated):Patch-releases will happen in the same way: A PR is created towards the "release-1.2.x" branch and if merged, that merge will be tagged as release and published. (Fixes are actually cherry-picked because they have to be merged to
main
before they can be backported, but that's a detail that's not relevant here).To visualize (based on the first diagram, again without progress on
main
to keep the diagram less complicated):The whole idea of that workflow is that
main
is always green and always in a release-able state and that development onmain
never slows down. Nobody has to care about me making a release off ofmain
, they are not impacted at all by that workflow.How to support these workflows
My question now is: How can these workflows be supported by
cargo-release
. From what I see, there's actually nothing that could be automated further (except for the parts withcargo-changelog
that are not yet implemented... but will be at some point).Maybe you can see how
cargo-release
can provide value for these workflows where I don't! 😆The text was updated successfully, but these errors were encountered: