Skip to content

Commit 610d18f

Browse files
committed
ci: Sign checksums and container image via Sigstore
Signed-off-by: James Alseth <[email protected]>
1 parent 1441245 commit 610d18f

File tree

3 files changed

+101
-28
lines changed

3 files changed

+101
-28
lines changed

.github/workflows/release.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,18 @@ jobs:
8282
args: release --clean
8383
version: "~> v1"
8484
env:
85-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86+
87+
- name: setup cosign
88+
uses: sigstore/cosign-installer@e9a05e6d32d7ed22b5656cd874ef31af58d05bfa # 3.8.2
89+
with:
90+
cosign-release: 'v2.5.0'
91+
92+
- name: sign checksums
93+
run: cosign sign-blob checksums.txt --yes
94+
working-directory: dist # Folder used by GoReleaser for build artifacts
95+
96+
- name: sign container image
97+
env:
98+
CONFTEST_VERSION: ${{ steps.get-version.outputs.VERSION }}
99+
run: cosign sign "$IMAGE/$CONFTEST_VERSION" --yes

.github/workflows/test_cosign.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: test-cosign
2+
3+
on: [pull_request]
4+
5+
permissions: read-all
6+
7+
env:
8+
IMAGE: openpolicyagent/conftest
9+
PLATFORMS: linux/amd64,linux/arm64
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
id-token: write
16+
steps:
17+
- name: checkout source
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: setup go
23+
uses: actions/setup-go@v5
24+
with:
25+
go-version: "1.24.x"
26+
27+
- name: release
28+
uses: goreleaser/goreleaser-action@v6
29+
with:
30+
args: release --auto-snapshot --skip-validate --skip-publish
31+
version: "~> v1"
32+
33+
- name: setup docker buildx
34+
run: docker buildx create --name conftestbuild --use
35+
36+
- name: Build only Docker latest image
37+
uses: docker/build-push-action@v6
38+
with:
39+
context: .
40+
push: false
41+
build-args: |
42+
VERSION=asdfg
43+
tags: |
44+
${{ env.IMAGE }}:asdfg
45+
platforms: ${{ env.PLATFORMS }}
46+
47+
- name: setup cosign
48+
uses: sigstore/cosign-installer@e9a05e6d32d7ed22b5656cd874ef31af58d05bfa # 3.8.2
49+
with:
50+
cosign-release: 'v2.5.0'
51+
52+
- name: sign checksums
53+
run: cosign sign-blob checksums.txt --yes --tlog-upload=false
54+
working-directory: dist # Folder used by GoReleaser for build artifacts
55+
56+
- name: sign container image
57+
env:
58+
CONFTEST_VERSION: asdfg
59+
run: cosign sign "$IMAGE/$CONFTEST_VERSION" --yes --upload=false --tlog-upload=false

.goreleaser.yml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ builds:
99
env:
1010
- CGO_ENABLED=0
1111
goos:
12-
- windows
12+
# - windows
1313
- linux
14-
- darwin
14+
# - darwin
1515
goarch:
1616
- amd64
17-
- arm64
18-
- ppc64le
19-
- s390x
17+
# - arm64
18+
# - ppc64le
19+
# - s390x
2020
ldflags:
2121
- "-s"
2222
- "-w"
@@ -45,28 +45,28 @@ archives:
4545
checksum:
4646
name_template: 'checksums.txt'
4747

48-
changelog:
49-
use: github
50-
groups:
51-
- title: New Features
52-
regexp: '^.*?feat(ure)?(\([[:word:]]+\))??!?:.+$'
53-
order: 0
54-
- title: Bug Fixes
55-
regexp: '^.*?(bug|fix)(\([[:word:]]+\))??!?:.+$'
56-
order: 1
57-
- title: OPA Changes
58-
regexp: '(?i)bump (opa|github.com/open-policy-agent/opa)'
59-
order: 5
60-
- title: Other Changes
61-
order: 999
62-
sort: asc
63-
filters:
64-
exclude:
65-
- '^.*?docs(\([[:word:]]+\))??!?:.+$'
66-
- '^.*?test(\([[:word:]]+\))??!?:.+$'
67-
- '^.*?misc(\([[:word:]]+\))??!?:.+$'
68-
- '^.*?typo(\([[:word:]]+\))??!?:.+$'
69-
- '(?i) typo( |\.|\r?\n)'
48+
# changelog:
49+
# use: github
50+
# groups:
51+
# - title: New Features
52+
# regexp: '^.*?feat(ure)?(\([[:word:]]+\))??!?:.+$'
53+
# order: 0
54+
# - title: Bug Fixes
55+
# regexp: '^.*?(bug|fix)(\([[:word:]]+\))??!?:.+$'
56+
# order: 1
57+
# - title: OPA Changes
58+
# regexp: '(?i)bump (opa|github.com/open-policy-agent/opa)'
59+
# order: 5
60+
# - title: Other Changes
61+
# order: 999
62+
# sort: asc
63+
# filters:
64+
# exclude:
65+
# - '^.*?docs(\([[:word:]]+\))??!?:.+$'
66+
# - '^.*?test(\([[:word:]]+\))??!?:.+$'
67+
# - '^.*?misc(\([[:word:]]+\))??!?:.+$'
68+
# - '^.*?typo(\([[:word:]]+\))??!?:.+$'
69+
# - '(?i) typo( |\.|\r?\n)'
7070

7171
# Publishes the deb and rpm files to the GitHub releases page.
7272
nfpms:

0 commit comments

Comments
 (0)