Skip to content

Commit a4d73c1

Browse files
authored
ci: enable attestations on binaries and images (#313)
Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
1 parent 3a31c02 commit a4d73c1

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

.github/workflows/ci-docker.yml

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

.github/workflows/publish.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,16 @@ jobs:
4444
os: [linux, darwin, freebsd, windows]
4545
arch: [amd64, arm64]
4646
runs-on: ubuntu-latest
47+
permissions:
48+
id-token: write
49+
contents: read
50+
attestations: write
4751
needs: [create-draft-release]
4852
steps:
4953
- run: "echo \"RELEASE_TAG=${GITHUB_REF#refs/tags/}\" >> $GITHUB_ENV"
5054
- uses: actions/checkout@v4
55+
with:
56+
fetch-depth: '0'
5157
- uses: actions/setup-go@v5
5258
with:
5359
go-version: 1.22.x
@@ -60,19 +66,30 @@ jobs:
6066
if [[ ${{ matrix.os }} == windows ]]; then
6167
_filename=${_filename}.exe
6268
fi
63-
mv cardano-node-api ${_filename}
69+
cp cardano-node-api ${_filename}
6470
curl \
6571
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
6672
-H "Content-Type: application/octet-stream" \
6773
--data-binary @${_filename} \
6874
https://uploads.github.com/repos/${{ github.repository_owner }}/cardano-node-api/releases/${{ needs.create-draft-release.outputs.RELEASE_ID }}/assets?name=${_filename}
75+
- name: Attest binary
76+
uses: actions/attest-build-provenance@v2
77+
with:
78+
subject-path: 'cardano-node-api'
6979

7080
build-images:
7181
runs-on: ubuntu-latest
82+
permissions:
83+
id-token: write
84+
contents: read
85+
attestations: write
86+
packages: write
7287
needs: [create-draft-release]
7388
steps:
7489
- run: "echo \"RELEASE_TAG=${GITHUB_REF#refs/tags/}\" >> $GITHUB_ENV"
7590
- uses: actions/checkout@v4
91+
with:
92+
fetch-depth: '0'
7693
- name: Set up QEMU
7794
uses: docker/setup-qemu-action@v3
7895
- name: Set up Docker Buildx
@@ -102,12 +119,25 @@ jobs:
102119
# semver
103120
type=semver,pattern={{version}}
104121
- name: Build images
122+
id: push
105123
uses: docker/build-push-action@v6
106124
with:
107125
outputs: "type=registry,push=true"
108126
platforms: linux/amd64,linux/arm64
109127
tags: ${{ steps.meta.outputs.tags }}
110128
labels: ${{ steps.meta.outputs.labels }}
129+
- name: Attest Docker Hub image
130+
uses: actions/attest-build-provenance@v2
131+
with:
132+
subject-name: index.docker.io/blinklabs/cardano-node-api
133+
subject-digest: ${{ steps.push.outputs.digest }}
134+
push-to-registry: true
135+
- name: Attest GHCR image
136+
uses: actions/attest-build-provenance@v2
137+
with:
138+
subject-name: ghcr.io/${{ github.repository }}
139+
subject-digest: ${{ steps.push.outputs.digest }}
140+
push-to-registry: true
111141
# Update Docker Hub from README
112142
- name: Docker Hub Description
113143
uses: peter-evans/dockerhub-description@v4

0 commit comments

Comments
 (0)