Refactor gem build hooks #86
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue Summary
As we move towards continuous delivery, and start applying branch protection rules to our repositories' mainline branches, we'll need to consider what the implications are for building and releasing gems.
In the CD ethos, we should be striving to automate the release of gems when suitable criteria are met. This is sometimes done by having a CI agent watch for tagged commits, and build and release those. However, one drawback here is that it's not currently possible on GitHub to "protect" tags in the same way that we can protect branches.
Ideally, our building/releasing would be part of the merge lifecycle.
PR Summary
This PR takes inspiration from Bundler's
gem_tasks, and extends them to allowbuild(and thusrelease) to only proceed if the version tag does not already exist in the repository.This would allow something like the
publish-rubygemsaction to run against the mainline branch, and automatically build/tag/release when it see the gemspec version change - which would only be possible via an authorised merge into the protected branch.Additionally, we continue to use (and clean up) our legacy
audit:check_safetycode review integration for the time being; in due course, PR reviewing should give use the same level of assurance and accountability.