Even if we have dry run in place it is still possible that during the real run deploying to Maven Central will fail. To make the process more resilient against this situation we should implement this logic in the release script
delete branch <version>-candidate if exists
- create branch <version-candidate> and use it
- Execute the release
- When the artifacts are deployed in Maven Central then
- Apply changes from the candidate branch to master
- Delete the candidate branch
When the release process fails in any step then master will not be affected and if it fails after artifacts are released then it can be completed manually in an easy way.