[wip] automate versioned Homebrew formula publishing
Created by: courier-new
This is the initial, simpler solution to https://github.com/sourcegraph/src-cli/issues/862 which assumes we continue to publish src-cli the way we typically have, i.e. only ever releasing a new latest version. It assumes that the newer a tag is, the later the version is. This is absolutely not a good assumption to make most of the time, however it turns out to be remarkably realistic for our repository. With the exception of the 4.0.0-rc release, we have not had a patch release on an older major version since March of 2020.
It adds a goreleaser-pre
step which:
- Fetches the current/new and previous version tags
- Converts the current "main" formula in the Homebrew tap repository into a versioned formula
It then lets goreleaser
run like normal, which will update the main Homebrew formula.
It then also adds a goreleaser-post
step which:
- Updates the symlink for the new latest version
Test plan
- Set up fork of Homebrew tap repo as if 4.0.1 was the latest release (main formula is for 4.0.1, versioned formulas up to 4.0.0, symlink for 4.0.1)
- Update GH action to skip
goreleaser
step (don't want to actually publish anything new), point pre and post steps at fork repo - Trigger action
- Observed expected results (main formula is converted into versioned formula, symlink for 4.0.2, no other side effects)