8
8
jobs :
9
9
build :
10
10
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
+
11
26
steps :
27
+ - name : Version
28
+ id : version
29
+ run : echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//}
30
+
12
31
- name : Checkout
13
32
uses : actions/checkout@v2
14
33
17
36
with :
18
37
go-version : 1.17.1
19
38
20
- - name : Cache Dependencies
39
+ - name : Cache Go
21
40
uses : actions/cache@v2
22
41
with :
23
42
path : |
@@ -31,32 +50,28 @@ jobs:
31
50
if : steps.cache-deps.outputs.cache-hit != 'true'
32
51
run : go mod download
33
52
34
- - name : Build Linux AMD64
35
- run : GOOS=linux GOARCH=amd64 go build -o kubectl-curl_linux_amd64
36
-
37
- - name : Build Linux ARM64
38
- run : GOOS=linux GOARCH=arm64 go build -o kubectl-curl_linux_arm64
39
-
40
- - name : Build Darwin AMD64
41
- run : GOOS=darwin GOARCH=amd64 go build -o kubectl-curl_darwin_amd64
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
42
58
43
- - name : Build Darwin ARM64
44
- run : GOOS=darwin GOARCH=arm64 go build -o kubectl-curl_darwin_arm64
45
-
46
- - name : Build Windows AMD64
47
- run : GOOS=windows GOARCH=amd64 go build -o kubectl-curl_windows_amd64.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
48
64
49
- - name : Build Windows ARM64
50
- run : GOOS=windows GOARCH=arm64 go build -o kubectl-curl_windows_arm64.exe
65
+ release :
66
+ runs-on : ubuntu-latest
67
+ needs : [build]
68
+ steps :
69
+ - name : Download Artifacts
70
+ uses : actions/download-artifact@v2
71
+ with :
72
+ path : .
51
73
52
- - name : Release
74
+ - name : Release Artifacts
53
75
uses : softprops/action-gh-release@v1
54
76
with :
55
- files : |
56
- LICENSE
57
- kubectl-curl_linux_amd64
58
- kubectl-curl_linux_arm64
59
- kubectl-curl_darwin_amd64
60
- kubectl-curl_darwin_arm64
61
- kubectl-curl_windows_amd64.exe
62
- kubectl-curl_windows_arm64.exe
77
+ files : kubectl-curl_*/*
0 commit comments