Skip to content

Commit 6ee714f

Browse files
authored
add gitsign image (#483)
Signed-off-by: cpanato <ctadeu@gmail.com>
1 parent 73f9f15 commit 6ee714f

File tree

2 files changed

+113
-74
lines changed

2 files changed

+113
-74
lines changed

.github/workflows/release.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
permissions:
1010
contents: write # needed to write releases
1111
id-token: write # needed for keyless signing
12+
packages: write # needed for push images
1213

1314
jobs:
1415
release:
@@ -23,13 +24,33 @@ jobs:
2324
go-version: '1.22'
2425
check-latest: true
2526

27+
- uses: imjasonh/setup-crane@e82f1b9a8007d399333baba4d75915558e9fb6a4 # v0.2
28+
2629
- uses: sigstore/cosign-installer@e1523de7571e31dbe865fd2e80c5c7c23ae71eb4 # v3.4.0
2730

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

33+
- name: Set env
34+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> "$GITHUB_ENV"
35+
36+
- name: Login to GitHub Containers
37+
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
38+
with:
39+
registry: ghcr.io
40+
username: ${{ github.repository_owner }}
41+
password: ${{ secrets.GITHUB_TOKEN }}
42+
3043
- uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
3144
with:
3245
version: latest
3346
args: release --clean
3447
env:
3548
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
KO_DOCKER_REPO: ghcr.io/sigstore/gitsign
50+
51+
- name: sign image
52+
run: |
53+
digest=$(crane digest ghcr.io/sigstore/gitsign:${{ env.RELEASE_VERSION }})
54+
cosign sign "ghcr.io/sigstore/gitsign@${digest}"
55+
env:
56+
COSIGN_YES: true

.goreleaser.yaml

Lines changed: 92 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,88 @@
11
project_name: gitsign
22

3+
gomod:
4+
proxy: true
5+
36
builds:
4-
- id: gitsign
5-
mod_timestamp: '{{ .CommitTimestamp }}'
6-
env:
7-
- CGO_ENABLED=0
8-
flags:
9-
- -trimpath
10-
goos:
11-
- linux
12-
- darwin
13-
- freebsd
14-
- windows
15-
goarch:
16-
- amd64
17-
- arm64
18-
ldflags:
19-
- "-s -w"
20-
- "-extldflags=-zrelro"
21-
- "-extldflags=-znow"
22-
- "-buildid= -X github.com/sigstore/gitsign/pkg/version.gitVersion={{ .Version }}"
7+
- id: gitsign
8+
mod_timestamp: '{{ .CommitTimestamp }}'
9+
env:
10+
- CGO_ENABLED=0
11+
flags:
12+
- -trimpath
13+
goos:
14+
- linux
15+
- darwin
16+
- freebsd
17+
- windows
18+
goarch:
19+
- amd64
20+
- arm64
21+
ldflags:
22+
- "-s -w"
23+
- "-extldflags=-zrelro"
24+
- "-extldflags=-znow"
25+
- "-buildid= -X github.com/sigstore/gitsign/pkg/version.gitVersion={{ .Version }}"
2326

24-
- id: gitsign-credential-cache
25-
mod_timestamp: '{{ .CommitTimestamp }}'
26-
main: ./cmd/gitsign-credential-cache
27-
binary: gitsign-credential-cache
28-
env:
29-
- CGO_ENABLED=0
30-
flags:
31-
- -trimpath
32-
goos:
33-
- linux
34-
- darwin
35-
- freebsd
36-
# - windows # TODO: fix undefined: syscall.Umask for windows builds
37-
goarch:
38-
- amd64
39-
- arm64
40-
ldflags:
41-
- "-s -w"
42-
- "-extldflags=-zrelro"
43-
- "-extldflags=-znow"
44-
- "-buildid= -X github.com/sigstore/gitsign/pkg/version.gitVersion={{ .Version }}"
27+
- id: gitsign-credential-cache
28+
mod_timestamp: '{{ .CommitTimestamp }}'
29+
main: ./cmd/gitsign-credential-cache
30+
binary: gitsign-credential-cache
31+
env:
32+
- CGO_ENABLED=0
33+
flags:
34+
- -trimpath
35+
goos:
36+
- linux
37+
- darwin
38+
- freebsd
39+
# - windows # TODO: fix undefined: syscall.Umask for windows builds
40+
goarch:
41+
- amd64
42+
- arm64
43+
ldflags:
44+
- "-s -w"
45+
- "-extldflags=-zrelro"
46+
- "-extldflags=-znow"
47+
- "-buildid= -X github.com/sigstore/gitsign/pkg/version.gitVersion={{ .Version }}"
4548

4649
nfpms:
47-
- id: default
48-
package_name: gitsign
49-
vendor: Sigstore
50-
homepage: https://github.com/sigstore/gitsign
51-
maintainer: Billy Lynch <info@sigstore.dev>
52-
description: Keyless git commit signing using OIDC identity
53-
builds:
54-
- gitsign
55-
- gitsign-credential-cache
56-
formats:
57-
- apk
58-
- deb
59-
- rpm
50+
- id: default
51+
package_name: gitsign
52+
vendor: Sigstore
53+
homepage: https://github.com/sigstore/gitsign
54+
maintainer: Billy Lynch <info@sigstore.dev>
55+
description: Keyless git commit signing using OIDC identity
56+
builds:
57+
- gitsign
58+
- gitsign-credential-cache
59+
formats:
60+
- apk
61+
- deb
62+
- rpm
6063

6164
archives:
62-
- id: binary
63-
format: binary
64-
allow_different_binary_count: true
65+
- id: binary
66+
format: binary
67+
allow_different_binary_count: true
6568

66-
gomod:
67-
proxy: true
69+
kos:
70+
- id: gitsign
71+
repository: github.com/sigstore/gitsign
72+
tags:
73+
- 'v{{ .Version }}'
74+
ldflags:
75+
- "-s -w -extldflags=-zrelro -extldflags=-znow -buildid= -X github.com/sigstore/gitsign/pkg/version.gitVersion={{ .Version }}"
76+
main: .
77+
bare: true
78+
preserve_import_paths: false
79+
base_import_paths: false
80+
sbom: spdx
81+
base_image: cgr.dev/chainguard/git:latest
82+
platforms:
83+
- linux/amd64
84+
- linux/arm64
85+
- linux/arm
6886

6987
checksum:
7088
name_template: 'checksums.txt'
@@ -73,24 +91,24 @@ source:
7391
enabled: true
7492

7593
sboms:
76-
- id: binaries
77-
artifacts: binary
78-
- id: packages
79-
artifacts: package
94+
- id: binaries
95+
artifacts: binary
96+
- id: packages
97+
artifacts: package
8098

8199
signs:
82-
- cmd: cosign
83-
env:
84-
- COSIGN_YES=true
85-
certificate: '${artifact}.pem'
86-
signature: '${artifact}.sig'
87-
args:
88-
- sign-blob
89-
- '--output-certificate=${certificate}'
90-
- '--output-signature=${signature}'
91-
- '${artifact}'
92-
artifacts: binary
93-
output: true
100+
- cmd: cosign
101+
env:
102+
- COSIGN_YES=true
103+
certificate: '${artifact}.pem'
104+
signature: '${artifact}.sig'
105+
args:
106+
- sign-blob
107+
- '--output-certificate=${certificate}'
108+
- '--output-signature=${signature}'
109+
- '${artifact}'
110+
artifacts: binary
111+
output: true
94112

95113
release:
96114
prerelease: allow

0 commit comments

Comments
 (0)