Skip to content

Commit 31691c6

Browse files
authored
Create generator-generic-ossf-slsa3-publish.yml
1 parent 7cd8246 commit 31691c6

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
outputs:
23+
digests: ${{ steps.hash.outputs.digests }}
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
# ========================================================
29+
#
30+
# Step 1: Build your artifacts.
31+
#
32+
# ========================================================
33+
- name: Build artifacts
34+
run: |
35+
# These are some amazing artifacts.
36+
echo "artifact1" > artifact1
37+
echo "artifact2" > artifact2
38+
39+
# ========================================================
40+
#
41+
# Step 2: Add a step to generate the provenance subjects
42+
# as shown below. Update the sha256 sum arguments
43+
# to include all binaries that you generate
44+
# provenance for.
45+
#
46+
# ========================================================
47+
- name: Generate subject for provenance
48+
id: hash
49+
run: |
50+
set -euo pipefail
51+
52+
# List the artifacts the provenance will refer to.
53+
files=$(ls artifact*)
54+
# Generate the subjects (base64 encoded).
55+
echo "hashes=$(sha256sum $files | base64 -w0)" >> "${GITHUB_OUTPUT}"
56+
57+
provenance:
58+
needs: [build]
59+
permissions:
60+
actions: read # To read the workflow path.
61+
id-token: write # To sign the provenance.
62+
contents: write # To add assets to a release.
63+
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.4.0
64+
with:
65+
base64-subjects: "${{ needs.build.outputs.digests }}"
66+
upload-assets: true # Optional: Upload to a new release
67+
- name: Setup Go environment
68+
uses: actions/setup-go@v5.0.1
69+
with:
70+
# The Go version to download (if necessary) and use. Supports semver spec and ranges. Be sure to enclose this option in single quotation marks.
71+
go-version: # optional
72+
# Path to the go.mod or go.work file.
73+
go-version-file: # optional
74+
# Set this option to true if you want the action to always check for the latest available version that satisfies the version spec
75+
check-latest: # optional
76+
# Used to pull Go distributions from go-versions. Since there's a default, this is typically not supplied by the user. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting.
77+
token: # optional, default is ${{ github.server_url == 'https://github.com' && github.token || '' }}
78+
# Used to specify whether caching is needed. Set to true, if you'd like to enable caching.
79+
cache: # optional, default is true
80+
# Used to specify the path to a dependency file - go.sum
81+
cache-dependency-path: # optional
82+
# Target architecture for Go to use. Examples: x86, x64. Will use system architecture by default.
83+
architecture: # optional
84+

0 commit comments

Comments
 (0)