Skip to content

Commit 7b0df07

Browse files
authored
ci: generate provenance attestation from artifacts instead of files
Reference: actions/attest-build-provenance#290
1 parent 4e079f1 commit 7b0df07

File tree

1 file changed

+30
-16
lines changed

1 file changed

+30
-16
lines changed

.github/workflows/__package.yml

+30-16
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848

4949
env:
5050
WORKING_DIR: packaging/tauri
51+
ARTIFACT_NAME: ${{ format('jellyfin-vue_{0}', runner.os) }}
5152
ARTIFACTS_PATH: ${{
5253
format('target/release/{0}', matrix.platform == 'windows' && 'jellyfin-vue-tauri.exe' ||
5354
format('bundle/*/*.{0}', matrix.platform == 'macos' && 'dmg' || 'AppImage'))
@@ -86,19 +87,21 @@ jobs:
8687
- name: Build application 🛠️
8788
run: npm run build
8889

89-
- name: Create provenance attestation 🔏
90-
uses: actions/[email protected]
91-
continue-on-error: true
92-
with:
93-
subject-path: ${{ env.WORKING_DIR }}/${{ env.ARTIFACTS_PATH }}
94-
9590
- name: Upload built application artifact ⬆️🐧🍎🪟
9691
uses: actions/[email protected]
92+
id: artifact
9793
with:
9894
compression-level: 0
99-
name: jellyfin-vue_${{ runner.os }}
95+
name: ${{ env.ARTIFACT_NAME }}
10096
path: ${{ env.WORKING_DIR }}/${{ env.ARTIFACTS_PATH }}
10197

98+
- name: Create provenance attestation 🔏
99+
uses: actions/[email protected]
100+
continue-on-error: true
101+
with:
102+
subject-name: ${{ env.ARTIFACT_NAME }}
103+
subject-digest: sha256:${{ steps.artifact.outputs.artifact-digest }}
104+
102105
docker_inputs:
103106
name: Prepare Docker build variables 🏷️🐳
104107
runs-on: ubuntu-latest
@@ -171,6 +174,9 @@ jobs:
171174
matrix:
172175
platform: ${{ fromJson(inputs.architectures) }}
173176

177+
env:
178+
ARTIFACT_NAME: ${{ format('docker_image-linux_{0}', matrix.platform) }}
179+
174180
steps:
175181
- name: Checkout ⬇️
176182
uses: actions/[email protected]
@@ -205,16 +211,18 @@ jobs:
205211
206212
- name: Upload Docker image as artifact ⬆️📦
207213
uses: actions/[email protected]
214+
id: artifact
208215
with:
209216
compression-level: 0
210-
name: docker_image-linux_${{ matrix.platform }}
217+
name: ${{ env.ARTIFACT_NAME }}
211218
path: docker_image.tar
212219

213220
- name: Create provenance attestation 🔏
214221
uses: actions/[email protected]
215222
continue-on-error: true
216223
with:
217-
subject-path: docker_image.tar
224+
subject-name: ${{ env.ARTIFACT_NAME }}
225+
subject-digest: sha256:${{ steps.artifact.outputs.artifact-digest }}
218226

219227
- name: Upload cache artifact ⬆️⚙️
220228
uses: actions/[email protected]
@@ -230,6 +238,9 @@ jobs:
230238
runs-on: ubuntu-latest
231239
needs: docker
232240

241+
env:
242+
ARTIFACT_NAME: frontend
243+
233244
steps:
234245
- name: Download Docker image artifact 📦⬇️
235246
uses: actions/[email protected]
@@ -243,19 +254,21 @@ jobs:
243254
ASSETS=$(docker inspect $IMAGE_SHA --format='{{range .Config.Env}}{{println .}}{{end}}' | grep ^ASSETS= | cut -d '=' -f2-)
244255
docker cp $(docker create --name jf $IMAGE_SHA):$ASSETS/ ./dist
245256
246-
- name: Create provenance attestation 🔏
247-
uses: actions/[email protected]
248-
continue-on-error: true
249-
with:
250-
subject-path: dist
251-
252257
- name: Upload client artifact ⬆️💻
253258
uses: actions/[email protected]
259+
id: artifact
254260
with:
255261
compression-level: 0
256-
name: frontend
262+
name: ${{ env.ARTIFACT_NAME }}
257263
path: dist
258264

265+
- name: Create provenance attestation 🔏
266+
uses: actions/[email protected]
267+
continue-on-error: true
268+
with:
269+
subject-name: ${{ env.ARTIFACT_NAME }}
270+
subject-digest: sha256:${{ steps.artifact.outputs.artifact-digest }}
271+
259272
docker_merge:
260273
name: Merge Docker images 💿🐳
261274
runs-on: ubuntu-latest
@@ -317,6 +330,7 @@ jobs:
317330
318331
- name: Remove cache artifacts 🗑️
319332
uses: geekyeggo/[email protected]
333+
continue-on-error: true
320334
with:
321335
name: |
322336
buildx-*

0 commit comments

Comments
 (0)