Skip to content

Commit 307593a

Browse files
authored
Merge pull request #49 from nginxinc/areste-contributing
Define Github actions permissions and sign assets
2 parents e9fb656 + fe9d905 commit 307593a

File tree

3 files changed

+58
-80
lines changed

3 files changed

+58
-80
lines changed

.github/workflows/go-builder.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.github/workflows/release-builder.yml

Lines changed: 57 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Build and upload release artifact
22

3+
permissions:
4+
contents: read
5+
36
on:
47
release:
58
types: [created]
@@ -9,44 +12,60 @@ env:
912

1013
jobs:
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-
uses: alexellis/upload-assets@0.4.0
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/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"]'
69+
70+
- name: Update new version in krew-index
71+
uses: rajatjindal/krew-release-bot@v0.0.46

.github/workflows/scorecards.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: OpenSSF Scorecards
22
on:
33
branch_protection_rule: # yamllint disable-line rule:empty-values
44
schedule:
5-
- cron: "28 14 * * 2" # Run every Tuesday at 14:28 UTC
5+
- cron: "28 14 * * *" # Run daily at 14:28 UTC
66
push:
77
branches:
88
- main

0 commit comments

Comments
 (0)