Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SBOM generation and checksums signing to release #55

Merged
merged 4 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions .binny.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ tools:
- -X main.gitDescription={{ .Version }}
# note: sprig functions are available: http://masterminds.github.io/sprig/
- -X main.buildDate={{ now | date "2006-01-02T15:04:05Z07:00" }}

- name: binny
version:
want: v0.6.2
Expand Down Expand Up @@ -54,9 +55,17 @@ tools:
with:
repo: charmbracelet/glow

# used for signing the checksums file at release
- name: cosign
version:
want: v2.2.4
method: github-release
with:
repo: sigstore/cosign

- name: goreleaser
version:
want: v1.21.1
want: v1.25.1
method: github-release
with:
repo: goreleaser/goreleaser
Expand All @@ -70,7 +79,7 @@ tools:

- name: bouncer
version:
want: v0.1.0
want: v0.4.0
method: github-release
with:
repo: wagoodman/go-bouncer
Expand All @@ -84,7 +93,7 @@ tools:

- name: syft
version:
want: v0.95.0
want: v1.2.0
method: github-release
with:
repo: anchore/syft
repo: anchore/syft
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ jobs:
permissions:
contents: write
packages: write
issues: read
pull-requests: read
# required for goreleaser signs section with cosign
id-token: write
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
with:
Expand Down
52 changes: 52 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ release:
draft: false

env:
# required to support multi architecture docker builds
- CGO_ENABLED=0

builds:
Expand Down Expand Up @@ -35,6 +36,11 @@ builds:
- arm64
mod_timestamp: *build-timestamp
ldflags: *build-ldflags
hooks:
post:
- cmd: .tool/quill sign-and-notarize "{{ .Path }}" --dry-run={{ .IsSnapshot }} --ad-hoc={{ .IsSnapshot }} -vv
env:
- QUILL_LOG_FILE=/tmp/quill-{{ .Target }}.log

archives:
- id: linux-archives
Expand All @@ -43,3 +49,49 @@ archives:
- id: darwin-archives
builds:
- darwin-build

nfpms:
- license: "Apache 2.0"
maintainer: "Anchore, Inc"
homepage: &website "https://github.com/anchore/grant"
description: &description "A tool consumes SBOMS and details license information"
formats:
- rpm
- deb

brews:
- tap:
owner: anchore
name: homebrew-grant
token: "{{.Env.GITHUB_BREW_TOKEN}}"
ids:
- darwin-archives
- linux-archives
homepage: *website
description: *description
license: "Apache License 2.0"

sboms:
- artifacts: archive
# this is relative to the snapshot/dist directory, not the root of the repo
cmd: ../.tool/syft
documents:
- "{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}.sbom"
args:
- "scan"
- "$artifact"
- "--output"
- "json=$document"

signs:
- cmd: .tool/cosign
signature: "${artifact}.sig"
certificate: "${artifact}.pem"
args:
- "sign-blob"
- "--oidc-issuer=https://token.actions.githubusercontent.com"
wagoodman marked this conversation as resolved.
Show resolved Hide resolved
- "--output-certificate=${certificate}"
- "--output-signature=${signature}"
- "${artifact}"
- "--yes"
artifacts: checksum
3 changes: 2 additions & 1 deletion Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ tasks:
- "{{ .TOOL_DIR }}/chronicle"
- "{{ .TOOL_DIR }}/glow"
- "{{ .TOOL_DIR }}/goreleaser"
- "{{ .TOOL_DIR }}/bouncer"
status:
- "{{ .TOOL_DIR }}/binny check -v"
cmd: "{{ .TOOL_DIR }}/binny install -v"
Expand Down Expand Up @@ -141,7 +142,7 @@ tasks:
- cmd: "mkdir -p {{ .TMP_DIR }}"
silent: true
- cmd: |
cat .goreleaser.yaml >> {{ .TMP_DIR }}/goreleaser.yaml
cat .goreleaser.yaml > {{ .TMP_DIR }}/goreleaser.yaml
echo "dist: {{ .SNAPSHOT_DIR }}" >> {{ .TMP_DIR }}/goreleaser.yaml
- cmd: "{{ .TOOL_DIR }}/goreleaser release --clean --skip=publish --skip=sign --snapshot --config {{ .TMP_DIR }}/goreleaser.yaml"

Expand Down
Loading