Skip to content

Commit 8e4b091

Browse files
author
Achille
authored
Merge pull request #2 from segmentio/version-artifacts
add version to build artifacts
2 parents 8a836d6 + 927d394 commit 8e4b091

File tree

1 file changed

+40
-25
lines changed

1 file changed

+40
-25
lines changed

.github/workflows/release.yaml

Lines changed: 40 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,26 @@ 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:
27+
- name: Version
28+
id: version
29+
run: echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//}
30+
1231
- name: Checkout
1332
uses: actions/checkout@v2
1433

@@ -17,7 +36,7 @@ jobs:
1736
with:
1837
go-version: 1.17.1
1938

20-
- name: Cache Dependencies
39+
- name: Cache Go
2140
uses: actions/cache@v2
2241
with:
2342
path: |
@@ -31,32 +50,28 @@ jobs:
3150
if: steps.cache-deps.outputs.cache-hit != 'true'
3251
run: go mod download
3352

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
4258
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
4864

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: .
5173

52-
- name: Release
74+
- name: Release Artifacts
5375
uses: softprops/action-gh-release@v1
5476
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

Comments
 (0)