Skip to content

Commit 2ecb34e

Browse files
fix: use matrix to build images
1 parent ccdd1c5 commit 2ecb34e

File tree

1 file changed

+53
-4
lines changed

1 file changed

+53
-4
lines changed

.github/workflows/release.yaml

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,74 @@ on:
1414
- "v*"
1515

1616
jobs:
17-
linux:
17+
build:
1818
runs-on: ubuntu-latest
1919
if: github.repository_owner == 'ctrlplanedev'
20+
strategy:
21+
matrix:
22+
goos: [linux, darwin]
23+
goarch: [amd64, arm64]
24+
include:
25+
- goos: linux
26+
goarch: "386"
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0
32+
33+
- name: Set up Go
34+
uses: actions/setup-go@v5
35+
36+
- name: Build with GoReleaser
37+
uses: goreleaser/goreleaser-action@v5
38+
with:
39+
distribution: goreleaser
40+
version: "~> v2"
41+
args: release --clean --split
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
44+
GOOS: ${{ matrix.goos }}
45+
GOARCH: ${{ matrix.goarch }}
46+
47+
- name: Upload artifacts
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: dist-${{ matrix.goos }}-${{ matrix.goarch }}
51+
path: dist/**/*
52+
retention-days: 1
53+
54+
release:
55+
runs-on: ubuntu-latest
56+
needs: build
57+
if: github.repository_owner == 'ctrlplanedev'
2058
steps:
2159
- name: Checkout
2260
uses: actions/checkout@v4
61+
with:
62+
fetch-depth: 0
63+
2364
- name: Set up Go
2465
uses: actions/setup-go@v5
25-
- name: Install GoReleaser
66+
67+
- name: Download all artifacts
68+
uses: actions/download-artifact@v4
69+
with:
70+
path: dist
71+
pattern: dist-*
72+
merge-multiple: true
73+
74+
- name: Merge and Release
2675
uses: goreleaser/goreleaser-action@v5
2776
with:
2877
distribution: goreleaser
2978
version: "~> v2"
30-
args: release --clean
79+
args: continue --merge
3180
env:
3281
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
3382

3483
docker:
35-
needs: linux
84+
needs: release
3685
runs-on: ubuntu-latest
3786

3887
if: github.repository_owner == 'ctrlplanedev'

0 commit comments

Comments
 (0)