Use `GITHUB_REF_NAME` to determine current tag for release workflow
Created by: courier-new
(Hopefully) closes https://github.com/sourcegraph/src-cli/issues/878.
We'll now use the GitHub-provided environment variable GITHUB_REF_NAME
to determine the current (most recent) tag, rather than the unreliable sort. According to the docs, this value will be:
The short ref name of the branch or tag that triggered the workflow run. This value matches the branch or tag name shown on GitHub. For example,
feature-branch-1
.
I was able to test this locally with act (thanks Bolaji!!) using simulated tag push events. I tested that a new tag triggered the "new latest" version of the workflow and that an older patch version tag triggered the patch version. As a caveat, since I could only test with a simulated event, we of course can't guarantee that a real GitHub event wouldn't behave differently. But I have higher confidence, at least.
I also tried to clarify a couple comments, mostly because after staring at the words "latest" and "current" and "most recent" for a couple days, they all started to blur together in my mind. 🤪
Test plan
I'll take point on our 4.2 release (or any sooner patch, if it comes up) later this month to verify the workflow succeeds.