Skip to content

Commit d6625b5

Browse files
authored
ci: attestations for binaries and images (#250)
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent 69ebffb commit d6625b5

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.21.x
@@ -60,19 +70,33 @@ jobs:
6070
if [[ ${{ matrix.os }} == windows ]]; then
6171
_filename=${_filename}.exe
6272
fi
63-
mv nview ${_filename}
73+
cp nview ${_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 }}/nview/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: 'nview'
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
@@ -101,11 +125,24 @@ jobs:
101125
type=semver,pattern={{version}}
102126
- name: Build images
103127
uses: docker/build-push-action@v6
128+
id: push
104129
with:
105130
outputs: "type=registry,push=true"
106131
platforms: linux/amd64,linux/arm64
107132
tags: ${{ steps.meta.outputs.tags }}
108133
labels: ${{ steps.meta.outputs.labels }}
134+
- name: Attest Docker Hub image
135+
uses: actions/attest-build-provenance@v2
136+
with:
137+
subject-name: index.docker.io/blinklabs/nview
138+
subject-digest: ${{ steps.push.outputs.digest }}
139+
push-to-registry: true
140+
- name: Attest GHCR image
141+
uses: actions/attest-build-provenance@v2
142+
with:
143+
subject-name: ghcr.io/${{ github.repository }}
144+
subject-digest: ${{ steps.push.outputs.digest }}
145+
push-to-registry: true
109146
# Update Docker Hub from README
110147
- name: Docker Hub Description
111148
uses: peter-evans/dockerhub-description@v4

0 commit comments

Comments
 (0)