Skip to content

Commit 6171fa9

Browse files
authored
fix: replace release-guard workflow with revert-latest job (#4838)
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
1 parent 61d57c1 commit 6171fa9

3 files changed

Lines changed: 44 additions & 37 deletions

File tree

.github/workflows/release-guard.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
env:
1717
DOCKER_CLI_EXPERIMENTAL: "enabled"
1818
steps:
19+
# Setup steps - no external side effects.
1920
- name: Checkout
2021
uses: actions/checkout@v4
2122
with:
@@ -43,6 +44,25 @@ jobs:
4344
run: |
4445
sudo apt-get update
4546
sudo apt-get install -y upx
47+
48+
# GoReleaser pipeline (sequential, not atomic):
49+
# 1. build + archive + checksum + sign (local only, no side effects)
50+
# 2. homebrew tap update (commit to trufflesecurity/homebrew-trufflehog)
51+
# 3. docker images + manifests (DockerHub + GHCR, including :latest tags)
52+
# 4. github release creation (artifacts uploaded, make_latest: false)
53+
#
54+
# On failure: GoReleaser does not roll back completed phases. Depending
55+
# on where it failed, some subset of the above may have been published.
56+
# Check:
57+
# - Homebrew tap: https://github.com/trufflesecurity/homebrew-trufflehog
58+
# - DockerHub: https://hub.docker.com/r/trufflesecurity/trufflehog/tags
59+
# - GHCR: https://github.com/trufflesecurity/trufflehog/pkgs/container/trufflehog
60+
# - GH releases: https://github.com/trufflesecurity/trufflehog/releases
61+
#
62+
# If the GitHub release was created but artifacts are missing, the
63+
# install script (scripts/install.sh) will fail for users on that
64+
# version. The release is NOT marked latest (make_latest: false), so
65+
# /releases/latest still points to the previous good release.
4666
- name: Run GoReleaser
4767
uses: goreleaser/goreleaser-action@v6
4868
with:
@@ -53,7 +73,24 @@ jobs:
5373
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5474
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
5575
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
76+
77+
# Promotes the GitHub release to "latest" only after the Release job fully
78+
# succeeds (including post-steps). At this point, all artifacts have been
79+
# published: Docker images and :latest tags are live, the Homebrew tap is
80+
# updated, binaries are attached to the GitHub release, and checksums are
81+
# signed.
82+
#
83+
# If this job fails, the release exists with all artifacts but is not flagged
84+
# as latest. /releases/latest and scripts/install.sh still point to the
85+
# previous release. To manually promote:
86+
# gh release edit <tag> --latest --repo trufflesecurity/trufflehog
87+
mark-latest:
88+
needs: Release
89+
runs-on: ubuntu-latest
90+
steps:
5691
- name: Mark release as latest
57-
run: gh release edit ${{ github.ref_name }} --latest
92+
run: gh release edit "$TAG" --latest
5893
env:
59-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
94+
GH_TOKEN: ${{ github.token }}
95+
GH_REPO: ${{ github.repository }}
96+
TAG: ${{ github.ref_name }}

.goreleaser.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
version: 2
22
release:
3+
# GoReleaser creates the GitHub release before artifacts finish uploading.
4+
# scripts/install.sh queries /releases/latest to find the current version, so
5+
# a premature "latest" flag causes install failures during the upload window.
6+
# The release workflow's mark-latest job promotes the release only after
7+
# GoReleaser completes successfully.
38
make_latest: false
49
builds:
510
- id: trufflehog-upx

0 commit comments

Comments
 (0)