Skip to content

Commit ce2d01c

Browse files
Add GitHub Actions workflow for production release
1 parent 736bd64 commit ce2d01c

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Production Release & SLSA Provenance
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Triggers automatically when you push a version tag like v2.1.1
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
# 1. Build and package your python code artifacts
13+
build:
14+
outputs:
15+
hashes: ${{ steps.hash.outputs.hashes }}
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout Source Code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Python Environment
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.10'
25+
26+
- name: Build Source Distribution Tarball
27+
run: |
28+
pip install wheel
29+
python setup.py sdist bdist_wheel
30+
31+
- name: Generate Cryptographic SHA256 Artifact Hashes
32+
id: hash
33+
run: |
34+
cd dist
35+
echo "hashes=$(sha256sum * | base64 -w0)" >> "$GITHUB_OUTPUT"
36+
37+
- name: Upload Build Artifacts for Release
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: python-artifacts
41+
path: dist/
42+
43+
# 2. Automatically generate the secure SLSA3 Provenance manifest
44+
provenance:
45+
needs: [build]
46+
permissions:
47+
actions: read # Needed to intercept the workflow identity
48+
id-token: write # Needed to cryptographically sign the OIDC provenance
49+
contents: write # Needed to attach the provenance file to your release
50+
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0
51+
with:
52+
base64-subjects: "${{ needs.build.outputs.hashes }}"
53+
upload-assets: true # Attaches the generated provenance straight back to your GitHub Release matrix

0 commit comments

Comments
 (0)