Skip to content

Commit 8ba5d6f

Browse files
author
Nathan Sullivan
authored
GitHub Action goreleaser-test - convert to a matrix (#942)
github action goreleaser-test: convert to a matrix
1 parent a523551 commit 8ba5d6f

File tree

2 files changed

+8
-119
lines changed

2 files changed

+8
-119
lines changed

.github/workflows/build-test-deploy.yaml

Lines changed: 7 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,13 @@ jobs:
192192
name: collect
193193
path: bin/collect
194194

195-
goreleaser-test-darwin-amd64:
195+
goreleaser-test:
196196
runs-on: ubuntu-latest
197197
if: startsWith(github.ref, 'refs/tags/v') != true
198+
strategy:
199+
matrix:
200+
goarch: [amd64, arm64]
201+
goos: [darwin, linux, windows]
198202
steps:
199203
- name: Checkout
200204
uses: actions/checkout@v3
@@ -212,123 +216,8 @@ jobs:
212216
version: "v0.183.0"
213217
args: build --rm-dist --snapshot --config deploy/.goreleaser.yaml --single-target
214218
env:
215-
GOARCH: amd64
216-
GOOS: darwin
217-
218-
goreleaser-test-linux-amd64:
219-
runs-on: ubuntu-latest
220-
if: startsWith(github.ref, 'refs/tags/v') != true
221-
steps:
222-
- name: Checkout
223-
uses: actions/checkout@v3
224-
225-
- name: Unshallow
226-
run: git fetch --prune --unshallow
227-
228-
- uses: actions/setup-go@v3
229-
with:
230-
go-version: "1.19"
231-
232-
- name: Run GoReleaser
233-
uses: goreleaser/goreleaser-action@v4
234-
with:
235-
version: "v0.183.0"
236-
args: build --rm-dist --snapshot --config deploy/.goreleaser.yaml --single-target
237-
env:
238-
GOARCH: amd64
239-
GOOS: linux
240-
241-
goreleaser-test-windows-amd64:
242-
runs-on: ubuntu-latest
243-
if: startsWith(github.ref, 'refs/tags/v') != true
244-
steps:
245-
- name: Checkout
246-
uses: actions/checkout@v3
247-
248-
- name: Unshallow
249-
run: git fetch --prune --unshallow
250-
251-
- uses: actions/setup-go@v3
252-
with:
253-
go-version: "1.19"
254-
255-
- name: Run GoReleaser
256-
uses: goreleaser/goreleaser-action@v4
257-
with:
258-
version: "v0.183.0"
259-
args: build --rm-dist --snapshot --config deploy/.goreleaser.yaml --single-target
260-
env:
261-
GOARCH: amd64
262-
GOOS: windows
263-
264-
goreleaser-test-darwin-arm64:
265-
runs-on: ubuntu-latest
266-
if: startsWith(github.ref, 'refs/tags/v') != true
267-
steps:
268-
- name: Checkout
269-
uses: actions/checkout@v3
270-
271-
- name: Unshallow
272-
run: git fetch --prune --unshallow
273-
274-
- uses: actions/setup-go@v3
275-
with:
276-
go-version: "1.19"
277-
278-
- name: Run GoReleaser
279-
uses: goreleaser/goreleaser-action@v4
280-
with:
281-
version: "v0.183.0"
282-
args: build --rm-dist --snapshot --config deploy/.goreleaser.yaml --single-target
283-
env:
284-
GOARCH: arm64
285-
GOOS: darwin
286-
287-
goreleaser-test-linux-arm64:
288-
runs-on: ubuntu-latest
289-
if: startsWith(github.ref, 'refs/tags/v') != true
290-
steps:
291-
- name: Checkout
292-
uses: actions/checkout@v3
293-
294-
- name: Unshallow
295-
run: git fetch --prune --unshallow
296-
297-
- uses: actions/setup-go@v3
298-
with:
299-
go-version: "1.19"
300-
301-
- name: Run GoReleaser
302-
uses: goreleaser/goreleaser-action@v4
303-
with:
304-
version: "v0.183.0"
305-
args: build --rm-dist --snapshot --config deploy/.goreleaser.yaml --single-target
306-
env:
307-
GOARCH: arm64
308-
GOOS: linux
309-
310-
goreleaser-test-windows-arm64:
311-
runs-on: ubuntu-latest
312-
if: startsWith(github.ref, 'refs/tags/v') != true
313-
steps:
314-
- name: Checkout
315-
uses: actions/checkout@v3
316-
317-
- name: Unshallow
318-
run: git fetch --prune --unshallow
319-
320-
- uses: actions/setup-go@v3
321-
with:
322-
go-version: "1.19"
323-
324-
- name: Run GoReleaser
325-
uses: goreleaser/goreleaser-action@v4
326-
with:
327-
version: "v0.183.0"
328-
args: build --rm-dist --snapshot --config deploy/.goreleaser.yaml --single-target
329-
env:
330-
GOARCH: arm64
331-
GOOS: windows
219+
GOARCH: ${{ matrix.goarch }}
220+
GOOS: ${{ matrix.goos }}
332221

333222
goreleaser:
334223
runs-on: ubuntu-latest

deploy/.goreleaser.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ release:
66
builds:
77
- id: preflight
88
# NOTE: if you add any additional goos/goarch values, ensure you update ../.github/workflows/build-test-deploy.yaml
9-
# with the respective goreleaser-test-* jobs
9+
# specifically the matrix values for goreleaser-test
1010
goos:
1111
- linux
1212
- darwin

0 commit comments

Comments
 (0)