Skip to content

Commit f913169

Browse files
authored
Merge pull request #257 from cpanato/update-release
refactor release
2 parents 8618ab7 + 63bd87a commit f913169

File tree

15 files changed

+264
-92
lines changed

15 files changed

+264
-92
lines changed

.bom-config.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
namespace: https://sigs.k8s.io/bom
3+
license: Apache-2.0
4+
name: bom
5+
creator:
6+
person: The Kubernetes Authors
7+
tool: bom
8+
9+
artifacts:
10+
- type: file
11+
source: bom-amd64-windows.exe
12+
license: Apache-2.0
13+
gomodules: true
14+
15+
- type: file
16+
source: bom-amd64-darwin
17+
license: Apache-2.0
18+
gomodules: true
19+
20+
- type: file
21+
source: bom-amd64-linux
22+
license: Apache-2.0
23+
gomodules: true
24+
25+
- type: file
26+
source: bom-arm-linux
27+
license: Apache-2.0
28+
gomodules: true
29+
30+
- type: file
31+
source: bom-arm64-darwin
32+
license: Apache-2.0
33+
gomodules: true
34+
35+
- type: file
36+
source: bom-arm64-linux
37+
license: Apache-2.0
38+
gomodules: true
39+
40+
- type: file
41+
source: bom-ppc64le-linux
42+
license: Apache-2.0
43+
gomodules: true
44+
45+
- type: file
46+
source: bom-s390x-linux
47+
license: Apache-2.0
48+
gomodules: true

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
12+
permissions:
13+
id-token: write
14+
contents: write
15+
16+
env:
17+
COSIGN_YES: "true"
18+
19+
steps:
20+
- name: Check out code
21+
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
22+
with:
23+
fetch-depth: 1
24+
25+
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
26+
with:
27+
go-version: '1.20'
28+
check-latest: true
29+
30+
- name: Install cosign
31+
uses: sigstore/cosign-installer@c3667d99424e7e6047999fb6246c0da843953c65 # v3.0.1
32+
33+
- name: Install GoReleaser
34+
uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v4.2.0
35+
with:
36+
install-only: true
37+
38+
- name: Get TAG
39+
id: get_tag
40+
run: echo "TAG=${GITHUB_REF#refs/*/}" >> "$GITHUB_OUTPUT"
41+
42+
- name: Run Mage
43+
uses: magefile/mage-action@3b833fb24c0d19eed3aa760b9eb285b4b84f420f # v2.3.0
44+
with:
45+
version: latest
46+
args: buildBinaries
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/snapshot.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Snapshot
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
pull_request:
8+
9+
jobs:
10+
snapshot:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Check out code onto GOPATH
15+
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
16+
17+
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
18+
with:
19+
go-version: '1.20'
20+
check-latest: true
21+
22+
- name: Install GoReleaser
23+
uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v4.2.0
24+
with:
25+
install-only: true
26+
27+
- name: Run Mage
28+
uses: magefile/mage-action@3b833fb24c0d19eed3aa760b9eb285b4b84f420f # v2.3.0
29+
with:
30+
version: latest
31+
args: buildBinariesSnapshot
32+
33+
- name: check binary
34+
run: |
35+
./dist/bom-amd64-linux version
36+
cat ./dist/bom.json.spdx

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,4 @@ CHANGELOG-*.html
137137
bin
138138
qemu-*-static
139139
rootfs.tar
140+
dist/

.goreleaser.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
project_name: bom
2+
3+
env:
4+
- GO111MODULE=on
5+
- CGO_ENABLED=0
6+
- COSIGN_YES=true
7+
8+
before:
9+
hooks:
10+
- go mod tidy
11+
- /bin/bash -c 'if [ -n "$(git --no-pager diff --exit-code go.mod go.sum)" ]; then exit 1; fi'
12+
13+
gomod:
14+
proxy: true
15+
16+
builds:
17+
- id: bom
18+
no_unique_dist_dir: true
19+
binary: bom-{{ .Arch }}-{{ .Os }}
20+
main: ./cmd/bom
21+
goos:
22+
- darwin
23+
- linux
24+
- windows
25+
goarch:
26+
- amd64
27+
- arm64
28+
- arm
29+
- s390x
30+
- ppc64le
31+
goarm:
32+
- '7'
33+
ignore:
34+
- goos: windows
35+
goarch: arm64
36+
- goos: windows
37+
goarch: arm
38+
- goos: windows
39+
goarch: s390x
40+
- goos: windows
41+
goarch: ppc64le
42+
flags:
43+
- -trimpath
44+
ldflags:
45+
- "{{ .Env.BOM_LDFLAGS }}"
46+
47+
archives:
48+
- format: binary
49+
allow_different_binary_count: true
50+
51+
signs:
52+
# Keyless
53+
- id: bom-keyless
54+
signature: "${artifact}.sig"
55+
certificate: "${artifact}.pem"
56+
cmd: cosign
57+
args: ["sign-blob", "--output-signature", "${artifact}.sig", "--output-certificate", "${artifact}.pem", "${artifact}"]
58+
artifacts: all
59+
60+
sboms:
61+
- id: bom
62+
cmd: ./bom-amd64-linux
63+
args:
64+
- generate
65+
- "--output"
66+
- "bom.json.spdx"
67+
- "-d"
68+
- "../"
69+
- "-c"
70+
- "../.bom-config.yaml"
71+
- "--format"
72+
- "json"
73+
artifacts: any
74+
documents:
75+
- "bom.json.spdx"
76+
77+
checksum:
78+
name_template: 'checksums.txt'
79+
80+
snapshot:
81+
name_template: "{{ .Tag }}-next"
82+
83+
release:
84+
github:
85+
owner: kubernetes-sigs
86+
name: bom
87+
prerelease: auto
88+
89+
changelog:
90+
skip: true

cloudbuild.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@ steps:
3232
- mage.go
3333
- buildStaging
3434

35-
artifacts:
36-
objects:
37-
location: 'gs://k8s-staging-bom/${_PULL_BASE_REF}'
38-
paths:
39-
- "go/src/sigs.k8s.io/bom/output/*"
40-
4135
substitutions:
4236
# _GIT_TAG will be filled with a git-based tag for the image, of the form vYYYYMMDD-hash, and
4337
# can be used as a substitution

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ require (
1818
golang.org/x/term v0.6.0
1919
golang.org/x/tools v0.7.0
2020
gopkg.in/yaml.v2 v2.4.0
21-
sigs.k8s.io/release-utils v0.7.3
21+
sigs.k8s.io/release-utils v0.7.4-0.20230327115955-2b998c68e4b6
2222
)
2323

2424
require (

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,5 +273,5 @@ k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/
273273
mvdan.cc/editorconfig v0.2.0/go.mod h1:lvnnD3BNdBYkhq+B4uBuFFKatfp02eB6HixDvEz91C0=
274274
mvdan.cc/sh/v3 v3.5.1/go.mod h1:1JcoyAKm1lZw/2bZje/iYKWicU/KMd0rsyJeKHnsK4E=
275275
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
276-
sigs.k8s.io/release-utils v0.7.3 h1:6pS8x6c5RmdUgR9qcg1LO6hjUzuE4Yo9TGZ3DemrZdM=
277-
sigs.k8s.io/release-utils v0.7.3/go.mod h1:n0mVez/1PZYZaZUTJmxewxH3RJ/Lf7JUDh7TG1CASOE=
276+
sigs.k8s.io/release-utils v0.7.4-0.20230327115955-2b998c68e4b6 h1:3RZgcl4MiJO7jGbntYz6oabnF/aPQuqWNkwGR1xoHZE=
277+
sigs.k8s.io/release-utils v0.7.4-0.20230327115955-2b998c68e4b6/go.mod h1:wWdwP44w/z+zoXg0jUZiHieFcgS3Z5Bi7TP3f18IDOw=

0 commit comments

Comments
 (0)