Skip to content

Commit 1b4bd1a

Browse files
committed
feat: add asses signing
1 parent 3757c70 commit 1b4bd1a

File tree

1 file changed

+48
-38
lines changed

1 file changed

+48
-38
lines changed

.github/workflows/release-builder.yml

Lines changed: 48 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -18,41 +18,51 @@ jobs:
1818
runs-on: ubuntu-latest
1919

2020
steps:
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: Build
33-
run: |
34-
BUILD=$(git log --format='%H' -n 1)
35-
VERSION=$RELEASE_VERSION
36-
OSES="linux darwin windows"
37-
ARCHS="amd64 arm64"
38-
IFS=" "
39-
40-
for OS in $OSES; do
41-
for ARCH in $ARCHS; do
42-
echo "OS: ${OS} and ARCH: ${ARCH}"
43-
CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH} go build -ldflags "-w -s -X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Build=$BUILD\
44-
-X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Version=$VERSION"\
45-
-o release/kubectl-nginx_supportpkg_${VERSION}_${OS}_${ARCH}/kubectl-nginx_supportpkg
46-
cp LICENSE release/kubectl-nginx_supportpkg_${VERSION}_${OS}_${ARCH}/
47-
tar czvf release/kubectl-nginx_supportpkg_${VERSION}_${OS}_${ARCH}.tar.gz -C release/kubectl-nginx_supportpkg_${VERSION}_${OS}_${ARCH}/ .
48-
done; done
49-
50-
- name: Upload release binaries
51-
uses: alexellis/upload-assets@0.4.0
52-
env:
53-
GITHUB_TOKEN: ${{ github.token }}
54-
with:
55-
asset_paths: '["./release/*.gz"]'
56-
57-
- name: Update new version in krew-index
58-
uses: rajatjindal/krew-release-bot@v0.0.46
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+
uses: sigstore/cosign-installer@v3.6.0
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+
uses: alexellis/upload-assets@0.4.1
65+
env:
66+
GITHUB_TOKEN: ${{ github.token }}
67+
with:
68+
asset_paths: '["./release/*.gz", "./release/*.txt", "./release/*.sig", "./release/*.pem"]'

0 commit comments

Comments
 (0)