Skip to content

Commit 68f5d21

Browse files
authored
Add Release builder (#12)
1 parent 723cf26 commit 68f5d21

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/release-builder.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Build and upload release artifact
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
env:
8+
RELEASE_VERSION: ${{ github.event.release.tag_name }}
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set Release Version
19+
run: echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v4
23+
with:
24+
go-version: '1.21'
25+
26+
- name: Build
27+
run: |
28+
BUILD=$(git log --format='%H' -n 1)
29+
VERSION=$RELEASE_VERSION
30+
OSES="linux darwin"
31+
ARCHS="amd64 arm64"
32+
IFS=" "
33+
34+
for OS in $OSES; do
35+
for ARCH in $ARCHS; do
36+
echo "OS: ${OS} and ARCH: ${ARCH}"
37+
GOOS=${OS} GOARCH=${ARCH} go build -ldflags "-w -s -X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Build=$BUILD\
38+
-X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Version=$VERSION"\
39+
-o release/kubectl-nic-supportpkg_${VERSION}_${OS}_${ARCH}/kubectl-nic-supportpkg
40+
cp LICENSE release/kubectl-nic-supportpkg_${VERSION}_${OS}_${ARCH}/
41+
tar czvf release/kubectl-nic-supportpkg_${VERSION}_${OS}_${ARCH}.tar.gz -C release kubectl-nic-supportpkg_${VERSION}_${OS}_${ARCH}
42+
done; done
43+
44+
- name: Upload release binaries
45+
uses: alexellis/[email protected]
46+
env:
47+
GITHUB_TOKEN: ${{ github.token }}
48+
with:
49+
asset_paths: '["./release/*.gz"]'

0 commit comments

Comments
 (0)