Skip to content

Commit 04d27e5

Browse files
authored
Create generator-generic-ossf-slsa3-publish.yml
1 parent 286dae0 commit 04d27e5

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
# This workflow lets you generate SLSA provenance file for your project.
7+
# The generation satisfies level 3 for the provenance requirements - see https://slsa.dev/spec/v0.1/requirements
8+
# The project is an initiative of the OpenSSF (openssf.org) and is developed at
9+
# https://github.com/slsa-framework/slsa-github-generator.
10+
# The provenance file can be verified using https://github.com/slsa-framework/slsa-verifier.
11+
# For more information about SLSA and how it improves the supply-chain, visit slsa.dev.
12+
13+
name: SLSA generic generator
14+
on:
15+
workflow_dispatch:
16+
release:
17+
types: [created]
18+
19+
permissions: read-all
20+
21+
jobs:
22+
build:
23+
runs-on: ubuntu-latest
24+
outputs:
25+
digests: ${{ steps.hash.outputs.digests }}
26+
27+
steps:
28+
- uses: actions/checkout@v3
29+
30+
# ========================================================
31+
#
32+
# Step 1: Build your artifacts.
33+
#
34+
# ========================================================
35+
- name: Build artifacts
36+
run: |
37+
# These are some amazing artifacts.
38+
echo "artifact1" > artifact1
39+
echo "artifact2" > artifact2
40+
41+
# ========================================================
42+
#
43+
# Step 2: Add a step to generate the provenance subjects
44+
# as shown below. Update the sha256 sum arguments
45+
# to include all binaries that you generate
46+
# provenance for.
47+
#
48+
# ========================================================
49+
- name: Generate subject
50+
id: hash
51+
run: |
52+
set -euo pipefail
53+
54+
# List the artifacts the provenance will refer to.
55+
files=$(ls artifact*)
56+
# Generate the subjects (base64 encoded).
57+
echo "::set-output name=digests::$(sha256sum $files | base64 -w0)"
58+
59+
provenance:
60+
needs: [build]
61+
permissions:
62+
actions: read # To read the workflow path.
63+
id-token: write # To sign the provenance.
64+
contents: write # To add assets to a release.
65+
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
66+
with:
67+
base64-subjects: "${{ needs.build.outputs.digests }}"
68+
upload-assets: true # Optional: Upload to a new release

0 commit comments

Comments
 (0)