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