11name : Build and upload release artifact
22
3+ permissions :
4+ contents : read
5+
36on :
47 release :
58 types : [created]
912
1013jobs :
1114 build :
15+ permissions :
16+ contents : write
17+
1218 runs-on : ubuntu-latest
1319
1420 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@v5
23- with :
24- go-version : ' 1.22.4'
25-
26- - name : Build
27- run : |
28- BUILD=$(git log --format='%H' -n 1)
29- VERSION=$RELEASE_VERSION
30- OSES="linux darwin windows"
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- CGO_ENABLED=0 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-nginx_supportpkg_${VERSION}_${OS}_${ARCH}/kubectl-nginx_supportpkg
40- cp LICENSE release/kubectl-nginx_supportpkg_${VERSION}_${OS}_${ARCH}/
41- tar czvf release/kubectl-nginx_supportpkg_${VERSION}_${OS}_${ARCH}.tar.gz -C release/kubectl-nginx_supportpkg_${VERSION}_${OS}_${ARCH}/ .
42- done; done
43-
44- - name : Upload release binaries
45- 46- env :
47- GITHUB_TOKEN : ${{ github.token }}
48- with :
49- asset_paths : ' ["./release/*.gz"]'
50-
51- - name : Update new version in krew-index
52- uses :
rajatjindal/[email protected] 21+ - name : Checkout code
22+ uses : actions/checkout@v4
23+
24+ - name : Set Release Version
25+ run : echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
26+
27+ - name : Set up Go
28+ uses : actions/setup-go@v5
29+ with :
30+ go-version : ' 1.22.4'
31+
32+ - name : Install Cosign
33+ 34+ with :
35+ cosign-release : ' v2.4.0'
36+
37+ - name : Check cosign version
38+ run : cosign version
39+
40+ - name : Build
41+ run : |
42+ set -e
43+ BUILD=$(git log --format='%H' -n 1)
44+ VERSION=$RELEASE_VERSION
45+ OSES="linux darwin windows"
46+ ARCHS="amd64 arm64"
47+ IFS=" "
48+
49+ for OS in $OSES; do
50+ for ARCH in $ARCHS; do
51+ echo "OS: ${OS} and ARCH: ${ARCH}"
52+ CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} go build -ldflags "-w -s -X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Build=$BUILD\
53+ -X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Version=$VERSION"\
54+ -o release/kubectl-nginx_supportpkg_${VERSION}_${OS}_${ARCH}/kubectl-nginx_supportpkg
55+ cp LICENSE release/kubectl-nginx_supportpkg_${VERSION}_${OS}_${ARCH}/
56+ tar czvf release/kubectl-nginx_supportpkg_${VERSION}_${OS}_${ARCH}.tar.gz -C release/kubectl-nginx_supportpkg_${VERSION}_${OS}_${ARCH}/ .
57+ sha256sum "release/kubectl-nginx_supportpkg_${VERSION}_${OS}_${ARCH}.tar.gz" >> "release/kubectl-nginx_supportpkg_${VERSION}_checksums.txt"
58+ done; done
59+ cosign sign-blob "release/kubectl-nginx_supportpkg_${VERSION}_checksums.txt" \
60+ --output-signature="release/kubectl-nginx_supportpkg_${VERSION}_checksums.txt.sig" \
61+ --output-certificate="release/kubectl-nginx_supportpkg_${VERSION}_checksums.txt.pem" -y
62+
63+ - name : Upload release binaries
64+ 65+ env :
66+ GITHUB_TOKEN : ${{ github.token }}
67+ with :
68+ asset_paths : ' ["./release/*.gz", "./release/*.txt", "./release/*.sig", "./release/*.pem"]'
69+
70+ - name : Update new version in krew-index
71+ uses :
rajatjindal/[email protected]
0 commit comments