Skip to content

fix: replace release-guard workflow with revert-latest job#4838

Merged
sysread merged 3 commits intomainfrom
fix/release-guard-gh-repo
Mar 27, 2026
Merged

fix: replace release-guard workflow with revert-latest job#4838
sysread merged 3 commits intomainfrom
fix/release-guard-gh-repo

Conversation

@sysread
Copy link
Copy Markdown
Contributor

@sysread sysread commented Mar 25, 2026

Summary

The release-guard.yml workflow was broken from day one: the unset-latest job had no actions/checkout and no GH_REPO, so gh couldn't resolve the repo (original failure).

Rather than patch the guard (#4776), this removes it entirely and replaces the inline "Mark release as latest" step with a separate mark-latest job gated on needs: Release. The release is only promoted to latest after the entire Release job succeeds, including post-steps.

Changes:

  • delete release-guard.yml
  • replace the inline Mark release as latest step and revert-latest job with a mark-latest job that runs after Release succeeds
  • mark-latest sets GH_REPO explicitly (no checkout needed)
  • add comments to release.yml documenting the state progression through GoReleaser's non-atomic pipeline and what to check on failure at each phase
  • add comment to .goreleaser.yml explaining why make_latest: false is set

Supersedes #4776.

If mark-latest fails, the release and all artifacts exist but /releases/latest still points to the previous release. The workflow comments include the manual promotion command.

Test plan

  • verify workflow YAML is syntactically valid
  • confirm mark-latest job has GH_REPO set (the original bug)
  • review state-progression comments for accuracy against GoReleaser pipeline

@sysread sysread requested a review from a team March 25, 2026 17:38
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 25, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment thread .github/workflows/release.yml
Comment thread .github/workflows/release.yml Outdated
Comment on lines +70 to +73
if [ "$LATEST_TAG" != "$RELEASE_TAG" ]; then
echo "Tag $RELEASE_TAG is not marked as latest (latest is $LATEST_TAG), skipping."
exit 0
fi
Copy link
Copy Markdown
Contributor

@j2fw j2fw Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We edit the release to be latest as the last step in the Release job.

I think this means that early exit here makes this job only continue if that last step succeeded in setting the release with the pushed tag as latest, but one of the gh actions post steps failed at the end of the job. Even if those happened, the resulting artifacts exist and are valid, right?

If that's true, I wonder if this revert-latest job is worth maintaining.

Copy link
Copy Markdown
Contributor

@j2fw j2fw Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be cleaner to mark the release as latest in a separate gh action job in this same workflow, with a needs condition.

Then, it would only be eligible to run once Release has completed all steps and post-steps successfully. I expect that this would also handle cancellation of the job, which so far hasn't been handled with the if: failure() condition.

eg:

  mark-latest:
    needs: Release
    runs-on: ubuntu-latest
    steps:
      - run: gh release edit "$TAG" --latest
        env:
          GH_TOKEN: ${{ github.token }}
          GH_REPO: ${{ github.repository }}
          TAG: ${{ github.ref_name }}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. TBH, this whole release workflow makes me a little itchy. GoReleaser has already promoted the package, image, and brew tap. I wonder why we have make_release: false in .goreleaser.yml... ah, it's because goreleaser tags the release as latest before any artifacts get uploaded. Lovely.

I guess we can do a post-step after cleanup, but I definitely want to add more helpful error messaging around this. We have a lot of ways to end up in an intermediate release state here.

Also adds comments to:
- .goreleaser.yml: explains why make_release is set to false
- .github/workflows/release.yml: document release/artifact state at each step
@sysread sysread requested a review from j2fw March 27, 2026 16:56
@sysread sysread merged commit 6171fa9 into main Mar 27, 2026
14 checks passed
@sysread sysread deleted the fix/release-guard-gh-repo branch March 27, 2026 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants