Skip to content

Commit 354d0a6

Browse files
tashima42matttrach
andauthored
fix: Replace GoReleaser action (#2134)
Co-authored-by: Matt Trachier <matt.trachier@suse.com>
1 parent 6007b0b commit 354d0a6

3 files changed

Lines changed: 189 additions & 31 deletions

File tree

.github/workflows/manual-rc-release.yml

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: Manually Create RC Release
2-
32
on:
43
workflow_dispatch:
54
inputs:
@@ -12,14 +11,12 @@ on:
1211
tag:
1312
description: 'The rc tag to create, e.g. v1.2.3-rc.1'
1413
required: true
15-
1614
permissions:
1715
contents: write
1816
id-token: write
1917
issues: write
2018
pull-requests: write
2119
actions: read
22-
2320
jobs:
2421
rc-release:
2522
runs-on: ubuntu-latest
@@ -113,15 +110,58 @@ jobs:
113110
go-version-file: ${{ github.workspace }}/tags/${{ inputs.tag }}/go.mod
114111
cache-dependency-path: ${{ github.workspace }}/tags/${{ inputs.tag }}/go.sum
115112
cache: true
113+
- name: Setup goreleaser
114+
shell: bash
115+
run: |-
116+
OS="Linux"
117+
if [[ ${RUNNER_OS} != "Linux" ]]; then
118+
echo "Unsupported OS: ${RUNNER_OS}"
119+
exit 1
120+
fi
121+
122+
# renovate-local: goreleaser-x86_64
123+
GORELEASER_VERSION="v2.15.2"
124+
# renovate-local: goreleaser-x86_64=v2.15.2
125+
GORELEASER_CHECKSUM_x86_64="0ebdbf0353aba566b969dde746cc4e4806f96c27aa2f3971b229a9df7611fedc"
126+
127+
ARCH=$(uname -m)
128+
CHECKSUM="${GORELEASER_CHECKSUM_x86_64}"
129+
if [[ "${ARCH}" != "x86_64" ]]; then
130+
echo "Unsupported architecture: ${ARCH}"
131+
exit 1
132+
fi
133+
134+
FILE="goreleaser_${OS}_${ARCH}.tar.gz"
135+
136+
echo "Installing ${FILE}"
137+
curl -LO "https://github.com/goreleaser/goreleaser/releases/download/${GORELEASER_VERSION}/${FILE}"
138+
echo "${CHECKSUM} ${FILE}" | sha256sum -c
139+
tar -xf "${FILE}" goreleaser
140+
141+
if sudo -n true &> /dev/null; then
142+
sudo install -m 755 goreleaser /usr/local/bin/goreleaser
143+
else
144+
install -m 755 goreleaser /usr/local/bin/goreleaser
145+
fi
146+
rm -f "${FILE}" goreleaser
116147
- name: Run GoReleaser
117-
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 https://github.com/goreleaser/goreleaser-action
118-
with:
119-
args: release --clean --skip=validate --config ../../.goreleaser_rc.yml
120-
workdir: ${{ github.workspace }}/tags/${{ inputs.tag }}
121148
env:
122149
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123150
GPG_KEY_ID: ${{ env.GPG_KEY_ID }}
124151
GPG_PASSPHRASE: ${{ env.GPG_PASSPHRASE }}
152+
shell: bash
153+
run: |-
154+
goreleaser release --clean --skip=validate --config ../../.goreleaser_rc.yml
155+
if [[ ! -f dist/metadata.json ]] || [[ ! -s dist/metadata.json ]]; then
156+
echo "Missing required file: dist/metadata.json"
157+
exit 1
158+
fi
159+
if [[ ! -f dist/artifacts.json ]] || [[ ! -s dist/artifacts.json ]]; then
160+
echo "Missing required file: dist/artifacts.json"
161+
exit 1
162+
fi
163+
echo "metadata=$(tr -d '\n\r' < dist/metadata.json)" >> "${GITHUB_OUTPUT}"
164+
echo "artifacts=$(tr -d '\n\r' < dist/artifacts.json)" >> "${GITHUB_OUTPUT}"
125165
- name: 'Find Issues and Create Comments'
126166
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 https://github.com/actions/github-script
127167
env:

.github/workflows/manual-release.yml

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: Manually Create Full Release
2-
32
on:
43
workflow_dispatch:
54
inputs:
@@ -9,12 +8,10 @@ on:
98
sha:
109
description: 'The commit SHA to create the tag from, defaults to HEAD of the selected branch.'
1110
required: false
12-
1311
permissions:
1412
contents: write
1513
id-token: write
1614
actions: read
17-
1815
jobs:
1916
release:
2017
runs-on: ubuntu-latest
@@ -106,12 +103,55 @@ jobs:
106103
go-version-file: ${{ github.workspace }}/tags/${{ inputs.tag }}/go.mod
107104
cache-dependency-path: ${{ github.workspace }}/tags/${{ inputs.tag }}/go.sum
108105
cache: true
106+
- name: Setup goreleaser
107+
shell: bash
108+
run: |-
109+
OS="Linux"
110+
if [[ ${RUNNER_OS} != "Linux" ]]; then
111+
echo "Unsupported OS: ${RUNNER_OS}"
112+
exit 1
113+
fi
114+
115+
# renovate-local: goreleaser-x86_64
116+
GORELEASER_VERSION="v2.15.2"
117+
# renovate-local: goreleaser-x86_64=v2.15.2
118+
GORELEASER_CHECKSUM_x86_64="0ebdbf0353aba566b969dde746cc4e4806f96c27aa2f3971b229a9df7611fedc"
119+
120+
ARCH=$(uname -m)
121+
CHECKSUM="${GORELEASER_CHECKSUM_x86_64}"
122+
if [[ "${ARCH}" != "x86_64" ]]; then
123+
echo "Unsupported architecture: ${ARCH}"
124+
exit 1
125+
fi
126+
127+
FILE="goreleaser_${OS}_${ARCH}.tar.gz"
128+
129+
echo "Installing ${FILE}"
130+
curl -LO "https://github.com/goreleaser/goreleaser/releases/download/${GORELEASER_VERSION}/${FILE}"
131+
echo "${CHECKSUM} ${FILE}" | sha256sum -c
132+
tar -xf "${FILE}" goreleaser
133+
134+
if sudo -n true &> /dev/null; then
135+
sudo install -m 755 goreleaser /usr/local/bin/goreleaser
136+
else
137+
install -m 755 goreleaser /usr/local/bin/goreleaser
138+
fi
139+
rm -f "${FILE}" goreleaser
109140
- name: Run GoReleaser
110-
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 https://github.com/goreleaser/goreleaser-action
111-
with:
112-
args: release --clean --skip=validate --config ../../.goreleaser.yml
113-
workdir: ${{ github.workspace }}/tags/${{ inputs.tag }}
114141
env:
115142
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
116143
GPG_KEY_ID: ${{ env.GPG_KEY_ID }}
117144
GPG_PASSPHRASE: ${{ env.GPG_PASSPHRASE }}
145+
shell: bash
146+
run: |-
147+
goreleaser release --clean --skip=validate --config ../../.goreleaser.yml
148+
if [[ ! -f dist/metadata.json ]] || [[ ! -s dist/metadata.json ]]; then
149+
echo "Missing required file: dist/metadata.json"
150+
exit 1
151+
fi
152+
if [[ ! -f dist/artifacts.json ]] || [[ ! -s dist/artifacts.json ]]; then
153+
echo "Missing required file: dist/artifacts.json"
154+
exit 1
155+
fi
156+
echo "metadata=$(tr -d '\n\r' < dist/metadata.json)" >> "${GITHUB_OUTPUT}"
157+
echo "artifacts=$(tr -d '\n\r' < dist/artifacts.json)" >> "${GITHUB_OUTPUT}"

.github/workflows/release.yml

Lines changed: 95 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
name: release
2-
32
on:
43
push:
54
branches:
65
- release/v*
7-
86
env:
97
AWS_REGION: us-west-2
108
AWS_ROLE: arn:aws:iam::270074865685:role/terraform-module-ci-test
119
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
1210
ALL_TESTS_JSON: '["TestOneBasic","TestThreeBasic","TestProductionBasic"]'
1311
NIX_INSTALL_SHA: de490f61fcbaf9a5cabf2fa621ddb9ef93ad35d9a23a04e7d51b26e092b63691
1412
NIX_INSTALL_VERSION: 2.34.4
15-
1613
permissions:
1714
contents: write
1815
id-token: write
1916
issues: write
2017
pull-requests: write
2118
actions: read
22-
2319
jobs:
2420
setup:
2521
runs-on: ubuntu-latest
@@ -30,7 +26,6 @@ jobs:
3026
run: |
3127
JSON_LIST='${{env.ALL_TESTS_JSON}}'
3228
echo "tests=$JSON_LIST" >> "$GITHUB_OUTPUT"
33-
3429
release:
3530
runs-on: ubuntu-latest
3631
outputs:
@@ -64,7 +59,6 @@ jobs:
6459
} catch (error) {
6560
core.setFailed(`Failed to create comment on release PR: ${error.message}`);
6661
}
67-
6862
# this creates a loop using workflow logic,
6963
# each iteration of the loop is in its own job
7064
# this is important because we want each iteration to be a separate VM
@@ -81,7 +75,7 @@ jobs:
8175
runs-on: ubuntu-latest
8276
strategy:
8377
matrix:
84-
attempts: [1,2,3] # I want to have jobs specifically in place to retry or cancel a test based on IP collisions
78+
attempts: [1, 2, 3] # I want to have jobs specifically in place to retry or cancel a test based on IP collisions
8579
test_name: ${{ fromJSON(needs.setup.outputs.tests) }}
8680
steps:
8781
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 https://github.com/actions/checkout
@@ -234,7 +228,6 @@ jobs:
234228
const scriptPath = `${process.env.GITHUB_WORKSPACE}/.github/workflows/scripts/check-run.js`;
235229
const { default: script } = await import(scriptPath);
236230
await script({ process, github, core });
237-
238231
cleanup:
239232
needs:
240233
- setup
@@ -285,7 +278,6 @@ jobs:
285278
export AWS_MAX_ATTEMPTS="100"
286279
export AWS_RETRY_MODE="adaptive"
287280
./run_tests.sh -c $IDENTIFIER
288-
289281
report:
290282
needs:
291283
- setup
@@ -326,7 +318,6 @@ jobs:
326318
} catch (error) {
327319
core.setFailed(`Failed to create comment failure on release PR: ${error.message}`);
328320
}
329-
330321
rc-release:
331322
needs:
332323
- setup
@@ -408,14 +399,58 @@ jobs:
408399
409400
echo "Importing gpg key"
410401
echo "${GPG_KEY}" | gpg --import --batch > /dev/null || { echo "Failed to import GPG key"; exit 1; }
402+
- name: Setup goreleaser
403+
shell: bash
404+
run: |-
405+
OS="Linux"
406+
if [[ ${RUNNER_OS} != "Linux" ]]; then
407+
echo "Unsupported OS: ${RUNNER_OS}"
408+
exit 1
409+
fi
410+
411+
# renovate-local: goreleaser-x86_64
412+
GORELEASER_VERSION="v2.15.2"
413+
# renovate-local: goreleaser-x86_64=v2.15.2
414+
GORELEASER_CHECKSUM_x86_64="0ebdbf0353aba566b969dde746cc4e4806f96c27aa2f3971b229a9df7611fedc"
415+
416+
ARCH=$(uname -m)
417+
CHECKSUM="${GORELEASER_CHECKSUM_x86_64}"
418+
if [[ "${ARCH}" != "x86_64" ]]; then
419+
echo "Unsupported architecture: ${ARCH}"
420+
exit 1
421+
fi
422+
423+
FILE="goreleaser_${OS}_${ARCH}.tar.gz"
424+
425+
echo "Installing ${FILE}"
426+
curl -LO "https://github.com/goreleaser/goreleaser/releases/download/${GORELEASER_VERSION}/${FILE}"
427+
echo "${CHECKSUM} ${FILE}" | sha256sum -c
428+
tar -xf "${FILE}" goreleaser
429+
430+
if sudo -n true &> /dev/null; then
431+
sudo install -m 755 goreleaser /usr/local/bin/goreleaser
432+
else
433+
install -m 755 goreleaser /usr/local/bin/goreleaser
434+
fi
435+
rm -f "${FILE}" goreleaser
411436
- name: Run GoReleaser
412-
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 https://github.com/goreleaser/goreleaser-action
413-
with:
414-
args: release --clean --config .goreleaser_rc.yml
415437
env:
416438
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
417439
GPG_KEY_ID: ${{ env.GPG_KEY_ID }}
418440
GPG_PASSPHRASE: ${{ env.GPG_PASSPHRASE }}
441+
shell: bash
442+
run: |-
443+
goreleaser release --clean --config .goreleaser_rc.yml
444+
if [[ ! -f dist/metadata.json ]] || [[ ! -s dist/metadata.json ]]; then
445+
echo "Missing required file: dist/metadata.json"
446+
exit 1
447+
fi
448+
if [[ ! -f dist/artifacts.json ]] || [[ ! -s dist/artifacts.json ]]; then
449+
echo "Missing required file: dist/artifacts.json"
450+
exit 1
451+
fi
452+
echo "metadata=$(tr -d '\n\r' < dist/metadata.json)" >> "${GITHUB_OUTPUT}"
453+
echo "artifacts=$(tr -d '\n\r' < dist/artifacts.json)" >> "${GITHUB_OUTPUT}"
419454
- name: 'Find Issues and Create Comments'
420455
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 https://github.com/actions/github-script
421456
env:
@@ -426,7 +461,6 @@ jobs:
426461
const scriptPath = `${{ github.workspace }}/.github/workflows/scripts/rc-notify.js`;
427462
const { default: script } = await import(scriptPath);
428463
await script({github, context, core, process});
429-
430464
# This runs after release-please generates a release, so when the release PR is merged
431465
publish:
432466
needs:
@@ -473,11 +507,55 @@ jobs:
473507
474508
echo "Importing gpg key"
475509
echo "${GPG_KEY}" | gpg --import --batch > /dev/null || { echo "Failed to import GPG key"; exit 1; }
510+
- name: Setup goreleaser
511+
shell: bash
512+
run: |-
513+
OS="Linux"
514+
if [[ ${RUNNER_OS} != "Linux" ]]; then
515+
echo "Unsupported OS: ${RUNNER_OS}"
516+
exit 1
517+
fi
518+
519+
# renovate-local: goreleaser-x86_64
520+
GORELEASER_VERSION="v2.15.2"
521+
# renovate-local: goreleaser-x86_64=v2.15.2
522+
GORELEASER_CHECKSUM_x86_64="0ebdbf0353aba566b969dde746cc4e4806f96c27aa2f3971b229a9df7611fedc"
523+
524+
ARCH=$(uname -m)
525+
CHECKSUM="${GORELEASER_CHECKSUM_x86_64}"
526+
if [[ "${ARCH}" != "x86_64" ]]; then
527+
echo "Unsupported architecture: ${ARCH}"
528+
exit 1
529+
fi
530+
531+
FILE="goreleaser_${OS}_${ARCH}.tar.gz"
532+
533+
echo "Installing ${FILE}"
534+
curl -LO "https://github.com/goreleaser/goreleaser/releases/download/${GORELEASER_VERSION}/${FILE}"
535+
echo "${CHECKSUM} ${FILE}" | sha256sum -c
536+
tar -xf "${FILE}" goreleaser
537+
538+
if sudo -n true &> /dev/null; then
539+
sudo install -m 755 goreleaser /usr/local/bin/goreleaser
540+
else
541+
install -m 755 goreleaser /usr/local/bin/goreleaser
542+
fi
543+
rm -f "${FILE}" goreleaser
476544
- name: Run GoReleaser
477-
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 https://github.com/goreleaser/goreleaser-action
478-
with:
479-
args: release --clean --config .goreleaser.yml
480545
env:
481546
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
482547
GPG_KEY_ID: ${{ env.GPG_KEY_ID }}
483548
GPG_PASSPHRASE: ${{ env.GPG_PASSPHRASE }}
549+
shell: bash
550+
run: |-
551+
goreleaser release --clean --config .goreleaser.yml
552+
if [[ ! -f dist/metadata.json ]] || [[ ! -s dist/metadata.json ]]; then
553+
echo "Missing required file: dist/metadata.json"
554+
exit 1
555+
fi
556+
if [[ ! -f dist/artifacts.json ]] || [[ ! -s dist/artifacts.json ]]; then
557+
echo "Missing required file: dist/artifacts.json"
558+
exit 1
559+
fi
560+
echo "metadata=$(tr -d '\n\r' < dist/metadata.json)" >> "${GITHUB_OUTPUT}"
561+
echo "artifacts=$(tr -d '\n\r' < dist/artifacts.json)" >> "${GITHUB_OUTPUT}"

0 commit comments

Comments
 (0)