Skip to content

Commit eee9d82

Browse files
authored
ci: attestations for binaries and images (#247)
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent 89ddccc commit eee9d82

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

.github/workflows/ci-docker.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: '0'
1618
- name: qemu
1719
uses: docker/setup-qemu-action@v3
1820
- uses: docker/setup-buildx-action@v3

.github/workflows/publish.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,19 @@ jobs:
4545
arch: [amd64, arm64]
4646
runs-on: ubuntu-latest
4747
needs: [create-draft-release]
48+
permissions:
49+
actions: write
50+
attestations: write
51+
checks: write
52+
contents: write
53+
id-token: write
54+
packages: write
55+
statuses: write
4856
steps:
4957
- run: "echo \"RELEASE_TAG=${GITHUB_REF#refs/tags/}\" >> $GITHUB_ENV"
5058
- uses: actions/checkout@v4
59+
with:
60+
fetch-depth: '0'
5161
- uses: actions/setup-go@v5
5262
with:
5363
go-version: 1.22.x
@@ -60,19 +70,33 @@ jobs:
6070
if [[ ${{ matrix.os }} == windows ]]; then
6171
_filename=${_filename}.exe
6272
fi
63-
mv cdnsd ${_filename}
73+
cp cdnsd ${_filename}
6474
curl \
6575
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
6676
-H "Content-Type: application/octet-stream" \
6777
--data-binary @${_filename} \
6878
https://uploads.github.com/repos/${{ github.repository_owner }}/cdnsd/releases/${{ needs.create-draft-release.outputs.RELEASE_ID }}/assets?name=${_filename}
79+
- name: Attest binary
80+
uses: actions/attest-build-provenance@v2
81+
with:
82+
subject-path: 'cdnsd'
6983

7084
build-images:
7185
runs-on: ubuntu-latest
7286
needs: [create-draft-release]
87+
permissions:
88+
actions: write
89+
attestations: write
90+
checks: write
91+
contents: write
92+
id-token: write
93+
packages: write
94+
statuses: write
7395
steps:
7496
- run: "echo \"RELEASE_TAG=${GITHUB_REF#refs/tags/}\" >> $GITHUB_ENV"
7597
- uses: actions/checkout@v4
98+
with:
99+
fetch-depth: '0'
76100
- name: Set up QEMU
77101
uses: docker/setup-qemu-action@v3
78102
- name: Set up Docker Buildx
@@ -103,11 +127,24 @@ jobs:
103127
type=semver,pattern={{version}}
104128
- name: Build images
105129
uses: docker/build-push-action@v6
130+
id: push
106131
with:
107132
outputs: "type=registry,push=true"
108133
platforms: linux/amd64,linux/arm64
109134
tags: ${{ steps.meta.outputs.tags }}
110135
labels: ${{ steps.meta.outputs.labels }}
136+
- name: Attest Docker Hub image
137+
uses: actions/attest-build-provenance@v2
138+
with:
139+
subject-name: index.docker.io/blinklabs/cdnsd
140+
subject-digest: ${{ steps.push.outputs.digest }}
141+
push-to-registry: true
142+
- name: Attest GHCR image
143+
uses: actions/attest-build-provenance@v2
144+
with:
145+
subject-name: ghcr.io/${{ github.repository }}
146+
subject-digest: ${{ steps.push.outputs.digest }}
147+
push-to-registry: true
111148
# Update Docker Hub from README
112149
- name: Docker Hub Description
113150
uses: peter-evans/dockerhub-description@v4

0 commit comments

Comments
 (0)