Skip to content

Commit b7c12fa

Browse files
committed
chore: sign main/pr goreleaser outputs and upload them as artifacts
Signed-off-by: Sylvain Rabot <[email protected]>
1 parent 460f186 commit b7c12fa

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

.github/workflows/main.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ jobs:
7676

7777
GoReleaser:
7878
runs-on: "shipfox-4vcpu-ubuntu-2404"
79+
permissions:
80+
id-token: write
81+
attestations: write
7982
if: contains(github.event.pull_request.labels.*.name, 'build-images') || github.ref == 'refs/heads/main' || github.event_name == 'merge_group'
8083
steps:
8184
- name: Set up QEMU
@@ -112,6 +115,40 @@ jobs:
112115
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
113116
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
114117
118+
- uses: actions/upload-artifact@v4
119+
with:
120+
name: goreleaser-metadata
121+
path: |
122+
dist/*.json
123+
dist/ledger_checksums.txt
124+
retention-days: 7
125+
compression-level: 0
126+
127+
# TODO(@sylr): Move this to the Release workflow when proven working.
128+
# Generate attestations for the goreleaser output archives
129+
- uses: actions/attest-build-provenance@v2
130+
with:
131+
subject-checksums: ./dist/ledger_checksums.txt
132+
# Generate attestations for the goreleaser output binaries
133+
- uses: actions/attest-build-provenance@v2
134+
with:
135+
subject-path: ./dist/*/**
136+
# Extract image metadata from the artifacts.json file
137+
- run: |
138+
jq -r '[ .[]|select(.type=="Docker Manifest") | .extra.Digest ] | to_entries | .[] | ( "digest"+ (.key | tostring) + "=" + .value )' < dist/artifacts.json >> "$GITHUB_OUTPUT"
139+
jq -r '[ .[]|select(.type=="Docker Manifest") | .name | split(":")[0] ] | to_entries | .[] | ( "name"+ (.key | tostring) + "=" + .value )' < dist/artifacts.json >> "$GITHUB_OUTPUT"
140+
id: image_metadata
141+
# Generate attestations for docker images
142+
- uses: actions/attest-build-provenance@v2
143+
with:
144+
subject-digest: ${{ steps.image_metadata.outputs.digest0 }}
145+
subject-name: ${{ steps.image_metadata.outputs.name0 }}
146+
push-to-registry: true
147+
- uses: actions/attest-build-provenance@v2
148+
with:
149+
subject-digest: ${{ steps.image_metadata.outputs.digest1 }}
150+
subject-name: ${{ steps.image_metadata.outputs.name1 }}
151+
push-to-registry: true
115152

116153
Deploy:
117154
runs-on: "shipfox-2vcpu-ubuntu-2404"
@@ -145,4 +182,4 @@ jobs:
145182
--secret AUTH_TOKEN=$ARGOCD_REGION_AUTH_TOKEN
146183
+deploy-staging
147184
--TAG=$TAG
148-
--COMPONENT=$COMPONENT
185+
--COMPONENT=$COMPONENT

0 commit comments

Comments
 (0)