Skip to content

Commit 41decc9

Browse files
author
Achille Roussel
committed
use build matrix
1 parent a8ef22d commit 41decc9

File tree

1 file changed

+34
-27
lines changed

1 file changed

+34
-27
lines changed

.github/workflows/release.yaml

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,21 @@ on:
88
jobs:
99
build:
1010
runs-on: ubuntu-latest
11+
12+
env:
13+
GOOS: ${{ matrix.os }}
14+
GOARCH: ${{ matrix.arch }}
15+
16+
strategy:
17+
matrix:
18+
os:
19+
- linux
20+
- darwin
21+
- windows
22+
arch:
23+
- amd64
24+
- arm64
25+
1126
steps:
1227
- name: Version
1328
id: version
@@ -35,35 +50,27 @@ jobs:
3550
if: steps.cache-deps.outputs.cache-hit != 'true'
3651
run: go mod download
3752

38-
- name: Build Linux AMD64
39-
run: GOOS=linux GOARCH=amd64 go build -o kubectl-curl_${{ steps.version.outputs.tag }}_linux_amd64
40-
41-
#- name: Build Linux ARM64
42-
# run: GOOS=linux GOARCH=arm64 go build -o kubectl-curl_${{ steps.version.outputs.tag }}_linux_arm64
43-
44-
#- name: Build Darwin AMD64
45-
# run: GOOS=darwin GOARCH=amd64 go build -o kubectl-curl_${{ steps.version.outputs.tag }}_darwin_amd64
46-
47-
#- name: Build Darwin ARM64
48-
# run: GOOS=darwin GOARCH=arm64 go build -o kubectl-curl_${{ steps.version.outputs.tag }}_darwin_arm64
53+
- name: Build Artifacts
54+
run: |
55+
out=kubectl-curl_${{ steps.version.outputs.tag }}_${{ env.GOOS }}_${{ env.GOARCH }}
56+
go build -o $out
57+
tar czf $out.tar.gz $out LICENSE
4958
50-
#- name: Build Windows AMD64
51-
# run: GOOS=windows GOARCH=amd64 go build -o kubectl-curl_${{ steps.version.outputs.tag }}_windows_amd64.exe
52-
53-
#- name: Build Windows ARM64
54-
# run: GOOS=windows GOARCH=arm64 go build -o kubectl-curl_${{ steps.version.outputs.tag }}_windows_arm64.exe
59+
- name: Upload Artifacts
60+
uses: actions/upload-artifact@v2
61+
with:
62+
name: kubectl-curl_${{ steps.version.outputs.tag }}_${{ env.GOOS }}_${{ env.GOARCH }}
63+
path: kubectl-curl_${{ steps.version.outputs.tag }}_${{ env.GOOS }}_${{ env.GOARCH }}.tar.gz
5564

56-
- name: Generate Artifacts
57-
run: for bin in kubectl-curl_*; do tar czf $bin.tar.gz $bin LICENSE; done
65+
release:
66+
runs-on: ubuntu-latest
67+
needs: [build]
68+
steps:
69+
- name: Download Artifacts
70+
with:
71+
path: .
5872

59-
- name: Release
73+
- name: Release Artifacts
6074
uses: softprops/action-gh-release@v1
6175
with:
62-
files: |
63-
LICENSE
64-
kubectl-curl_${{ steps.version.outputs.tag }}_linux_amd64.tar.gz
65-
kubectl-curl_${{ steps.version.outputs.tag }}_linux_arm64.tar.gz
66-
kubectl-curl_${{ steps.version.outputs.tag }}_darwin_amd64.tar.gz
67-
kubectl-curl_${{ steps.version.outputs.tag }}_darwin_arm64.tar.gz
68-
kubectl-curl_${{ steps.version.outputs.tag }}_windows_amd64.exe.tar.gz
69-
kubectl-curl_${{ steps.version.outputs.tag }}_windows_arm64.exe.tar.gz
76+
files: kubectl-curl_*/*

0 commit comments

Comments
 (0)