Skip to content

Commit 303e835

Browse files
authored
Replace goreleaser-action with manual install (#4944) (#4951)
Download and verify the goreleaser binary directly instead of using the goreleaser/goreleaser-action. Install to ~/.local/bin and register it via GITHUB_PATH to avoid requiring sudo. Capture dist/metadata.json and dist/artifacts.json as step outputs to preserve the same interface used by downstream steps. Add strict bash error handling to both the setup and release steps.
1 parent dc28ac3 commit 303e835

1 file changed

Lines changed: 53 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,19 +116,66 @@ jobs:
116116
password: ${{ env.STAGE_REGISTRY_PASSWORD }}
117117
registry: ${{ env.STAGE_REGISTRY }}
118118

119+
- name: Setup goreleaser
120+
shell: bash
121+
run: |
122+
set -euo pipefail
123+
124+
OS="Linux"
125+
if [[ ${RUNNER_OS} != "Linux" ]]; then
126+
echo "Unsupported OS: ${RUNNER_OS}"
127+
exit 1
128+
fi
129+
130+
# renovate-local: goreleaser-x86_64
131+
GORELEASER_VERSION="v2.14.3"
132+
# renovate-local: goreleaser-x86_64=v2.14.3
133+
GORELEASER_CHECKSUM_x86_64="dc7faeeeb6da8bdfda788626263a4ae725892a8c7504b975c3234127d4a44579"
134+
135+
ARCH=$(uname -m)
136+
CHECKSUM="${GORELEASER_CHECKSUM_x86_64}"
137+
if [[ "${ARCH}" != "x86_64" ]]; then
138+
echo "Unsupported architecture: ${ARCH}"
139+
exit 1
140+
fi
141+
142+
FILE="goreleaser_${OS}_${ARCH}.tar.gz"
143+
144+
echo "Installing ${FILE}"
145+
curl --fail --location -O "https://github.com/goreleaser/goreleaser/releases/download/${GORELEASER_VERSION}/${FILE}"
146+
echo "${CHECKSUM} ${FILE}" | sha256sum -c
147+
tar -xf "${FILE}" goreleaser
148+
149+
mkdir -p "${HOME}/.local/bin"
150+
install -m 755 goreleaser "${HOME}/.local/bin/goreleaser"
151+
echo "${HOME}/.local/bin" >> "${GITHUB_PATH}"
152+
153+
rm -f "${FILE}" goreleaser
154+
119155
- name: Run GoReleaser
120-
uses: goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 # v7.0.0
121156
id: goreleaser
122-
with:
123-
distribution: goreleaser
124-
# renovate: datasource=github-releases depName=goreleaser/goreleaser
125-
version: v2.14.3
126-
args: release --clean --draft --verbose
127157
env:
128158
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
129159
GORELEASER_CURRENT_TAG: ${{ env.RELEASE_TAG }}
130160
STAGE_REGISTRY: ${{ env.STAGE_REGISTRY }}
131161
PRIME_REGISTRY: ${{ env.PRIME_REGISTRY }}
162+
shell: bash
163+
run: |
164+
set -euo pipefail
165+
166+
goreleaser release --clean --draft --verbose
167+
168+
if [[ ! -f dist/metadata.json ]] || [[ ! -s dist/metadata.json ]]; then
169+
echo "ERROR: dist/metadata.json not found or empty after GoReleaser run"
170+
exit 1
171+
fi
172+
173+
if [[ ! -f dist/artifacts.json ]] || [[ ! -s dist/artifacts.json ]]; then
174+
echo "ERROR: dist/artifacts.json not found or empty after GoReleaser run"
175+
exit 1
176+
fi
177+
echo "metadata=$(tr -d '\n\r' < dist/metadata.json)" >> "${GITHUB_OUTPUT}"
178+
echo "artifacts=$(tr -d '\n\r' < dist/artifacts.json)" >> "${GITHUB_OUTPUT}"
132179
133180
# Workaround until `docker manifest create` supports provenance meta data
134181
# Background: https://stackoverflow.com/questions/75521775/buildx-docker-image-claims-to-be-a-manifest-list

0 commit comments

Comments
 (0)