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 gitsign image #483

Merged
merged 1 commit into from
Apr 2, 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
21 changes: 21 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
permissions:
contents: write # needed to write releases
id-token: write # needed for keyless signing
packages: write # needed for push images

jobs:
release:
Expand All @@ -23,13 +24,33 @@ jobs:
go-version: '1.22'
check-latest: true

- uses: imjasonh/setup-crane@e82f1b9a8007d399333baba4d75915558e9fb6a4 # v0.2

- uses: sigstore/cosign-installer@e1523de7571e31dbe865fd2e80c5c7c23ae71eb4 # v3.4.0

- uses: anchore/sbom-action/download-syft@ab5d7b5f48981941c4c5d6bf33aeb98fe3bae38c # v0.15.10

- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> "$GITHUB_ENV"

- name: Login to GitHub Containers
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
KO_DOCKER_REPO: ghcr.io/sigstore/gitsign

- name: sign image
run: |
digest=$(crane digest ghcr.io/sigstore/gitsign:${{ env.RELEASE_VERSION }})
cosign sign "ghcr.io/sigstore/gitsign@${digest}"
env:
COSIGN_YES: true
166 changes: 92 additions & 74 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,70 +1,88 @@
project_name: gitsign

gomod:
proxy: true

builds:
- id: gitsign
mod_timestamp: '{{ .CommitTimestamp }}'
env:
- CGO_ENABLED=0
flags:
- -trimpath
goos:
- linux
- darwin
- freebsd
- windows
goarch:
- amd64
- arm64
ldflags:
- "-s -w"
- "-extldflags=-zrelro"
- "-extldflags=-znow"
- "-buildid= -X github.com/sigstore/gitsign/pkg/version.gitVersion={{ .Version }}"
- id: gitsign
mod_timestamp: '{{ .CommitTimestamp }}'
env:
- CGO_ENABLED=0
flags:
- -trimpath
goos:
- linux
- darwin
- freebsd
- windows
goarch:
- amd64
- arm64
ldflags:
- "-s -w"
- "-extldflags=-zrelro"
- "-extldflags=-znow"
- "-buildid= -X github.com/sigstore/gitsign/pkg/version.gitVersion={{ .Version }}"

- id: gitsign-credential-cache
mod_timestamp: '{{ .CommitTimestamp }}'
main: ./cmd/gitsign-credential-cache
binary: gitsign-credential-cache
env:
- CGO_ENABLED=0
flags:
- -trimpath
goos:
- linux
- darwin
- freebsd
# - windows # TODO: fix undefined: syscall.Umask for windows builds
goarch:
- amd64
- arm64
ldflags:
- "-s -w"
- "-extldflags=-zrelro"
- "-extldflags=-znow"
- "-buildid= -X github.com/sigstore/gitsign/pkg/version.gitVersion={{ .Version }}"
- id: gitsign-credential-cache
mod_timestamp: '{{ .CommitTimestamp }}'
main: ./cmd/gitsign-credential-cache
binary: gitsign-credential-cache
env:
- CGO_ENABLED=0
flags:
- -trimpath
goos:
- linux
- darwin
- freebsd
# - windows # TODO: fix undefined: syscall.Umask for windows builds
goarch:
- amd64
- arm64
ldflags:
- "-s -w"
- "-extldflags=-zrelro"
- "-extldflags=-znow"
- "-buildid= -X github.com/sigstore/gitsign/pkg/version.gitVersion={{ .Version }}"

nfpms:
- id: default
package_name: gitsign
vendor: Sigstore
homepage: https://github.com/sigstore/gitsign
maintainer: Billy Lynch <[email protected]>
description: Keyless git commit signing using OIDC identity
builds:
- gitsign
- gitsign-credential-cache
formats:
- apk
- deb
- rpm
- id: default
package_name: gitsign
vendor: Sigstore
homepage: https://github.com/sigstore/gitsign
maintainer: Billy Lynch <[email protected]>
description: Keyless git commit signing using OIDC identity
builds:
- gitsign
- gitsign-credential-cache
formats:
- apk
- deb
- rpm

archives:
- id: binary
format: binary
allow_different_binary_count: true
- id: binary
format: binary
allow_different_binary_count: true

gomod:
proxy: true
kos:
- id: gitsign
repository: github.com/sigstore/gitsign
tags:
- 'v{{ .Version }}'
ldflags:
- "-s -w -extldflags=-zrelro -extldflags=-znow -buildid= -X github.com/sigstore/gitsign/pkg/version.gitVersion={{ .Version }}"
main: .
bare: true
preserve_import_paths: false
base_import_paths: false
sbom: spdx
base_image: cgr.dev/chainguard/git:latest
platforms:
- linux/amd64
- linux/arm64
- linux/arm

checksum:
name_template: 'checksums.txt'
Expand All @@ -73,24 +91,24 @@ source:
enabled: true

sboms:
- id: binaries
artifacts: binary
- id: packages
artifacts: package
- id: binaries
artifacts: binary
- id: packages
artifacts: package

signs:
- cmd: cosign
env:
- COSIGN_YES=true
certificate: '${artifact}.pem'
signature: '${artifact}.sig'
args:
- sign-blob
- '--output-certificate=${certificate}'
- '--output-signature=${signature}'
- '${artifact}'
artifacts: binary
output: true
- cmd: cosign
env:
- COSIGN_YES=true
certificate: '${artifact}.pem'
signature: '${artifact}.sig'
args:
- sign-blob
- '--output-certificate=${certificate}'
- '--output-signature=${signature}'
- '${artifact}'
artifacts: binary
output: true

release:
prerelease: allow
Expand Down