Skip to content

Commit 7d09fe2

Browse files
committed
Try SLSA setup
1 parent 37024ad commit 7d09fe2

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: "Release"
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
jobs:
9+
build:
10+
name: "Build dists"
11+
runs-on: "ubuntu-latest"
12+
environment:
13+
name: "publish"
14+
outputs:
15+
hashes: ${{ steps.hash.outputs.hashes }}
16+
steps:
17+
- name: "Checkout repository"
18+
uses: "actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b" # tag=v3
19+
20+
- name: "Setup Python"
21+
uses: "actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984" # tag=v4
22+
with:
23+
python-version: "3.x"
24+
25+
- name: "Install dependencies"
26+
run: python -m pip install build
27+
28+
- name: Build using Python
29+
id: build
30+
run: |
31+
python -m build
32+
33+
- name: Generate subject
34+
id: hash
35+
run: |
36+
cd dist
37+
HASHES=$(sha256sum * | base64 -w0)
38+
echo "hashes=$HASHES" >> "$GITHUB_OUTPUT"
39+
40+
provenance:
41+
needs: [build]
42+
permissions:
43+
actions: read # To read the workflow path.
44+
id-token: write # To sign the provenance.
45+
contents: write # To add assets to a release.
46+
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.9.0
47+
with:
48+
base64-subjects: "${{ needs.build.outputs.hashes }}"
49+
upload-assets: true # Optional: Upload to a new release
50+
steps:
51+
- name: "Download dists"
52+
uses: "actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741"
53+
with:
54+
name: "dist"
55+
path: "dist/"
56+
57+
- name: "Upload dists to GitHub Release"
58+
env:
59+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
60+
# run: |
61+
# gh release upload ${{ github.ref_name }} dist/* --repo ${{ github.repository }}

0 commit comments

Comments
 (0)