4
4
workflow_dispatch :
5
5
inputs :
6
6
tag :
7
- description : Git tag of the existing release
7
+ description : Git tag of the existing release (e.g., v0.25.0)
8
8
required : true
9
9
type : string
10
10
11
11
permissions :
12
12
contents : write
13
13
id-token : write
14
+ attestations : write
14
15
15
16
jobs :
16
- sign-and-upload :
17
- name : Sign and upload Sigstore bundles for release assets
17
+ attest :
18
18
runs-on : ubuntu-latest
19
19
steps :
20
- - name : Create dist directory
20
+ - name : Prepare dist directory
21
21
run : mkdir -p dist
22
22
23
23
- name : Download assets from GitHub Release
@@ -28,76 +28,14 @@ jobs:
28
28
'${{ inputs.tag }}'
29
29
--repo '${{ github.repository }}'
30
30
-D dist/
31
+ -p '*.whl' -p '*.tar.gz'
31
32
32
33
- name : List downloaded files
33
34
run : ls -lah dist || true
34
35
35
- - name : Collect files to sign
36
- id : find
37
- shell : bash
38
- run : |
39
- set -euo pipefail
40
- shopt -s nullglob
41
- # Gather candidate distribution files
42
- candidates=(dist/*.whl dist/*.tar.gz)
43
- if [ ${#candidates[@]} -eq 0 ]; then
44
- echo "No distribution files found in dist/." >&2
45
- # Nothing to do; expose empty outputs
46
- echo 'inputs=' >> "$GITHUB_OUTPUT"
47
- echo 'bundles=' >> "$GITHUB_OUTPUT"
48
- exit 0
49
- fi
50
- # Filter to only those missing their .sigstore.json bundle
51
- to_sign=()
52
- bundles=()
53
- for f in "${candidates[@]}"; do
54
- b="${f}.sigstore.json"
55
- if [ ! -f "$b" ]; then
56
- to_sign+=("$f")
57
- bundles+=("$b")
58
- fi
59
- done
60
- if [ ${#to_sign[@]} -eq 0 ]; then
61
- echo "All bundles already present; nothing to sign."
62
- echo 'inputs=' >> "$GITHUB_OUTPUT"
63
- echo 'bundles=' >> "$GITHUB_OUTPUT"
64
- exit 0
65
- fi
66
- printf 'Will sign %d file(s):\n' "${#to_sign[@]}"
67
- printf '%s\n' "${to_sign[@]}"
68
- # Emit multiline outputs for subsequent steps
69
- {
70
- echo 'inputs<<EOF'
71
- printf '%s\n' "${to_sign[@]}"
72
- echo 'EOF'
73
- } >> "$GITHUB_OUTPUT"
74
- {
75
- echo 'bundles<<EOF'
76
- printf '%s\n' "${bundles[@]}"
77
- echo 'EOF'
78
- } >> "$GITHUB_OUTPUT"
79
-
80
- - name : Sign assets with Sigstore
81
- if : ${{ steps.find.outputs.inputs != '' }}
82
- uses : sigstore/gh-action-sigstore-python@v3.0.0
36
+ - name : Generate build provenance attestations
37
+ uses : actions/attest-build-provenance@v1
83
38
with :
84
- inputs : ${{ steps.find.outputs.inputs }}
85
-
86
- - name : Upload signatures to GitHub Release
87
- if : ${{ steps.find.outputs.bundles != '' }}
88
- env :
89
- GITHUB_TOKEN : ${{ github.token }}
90
- run : |
91
- set -euo pipefail
92
- # Read bundle list from the step output and upload only new ones
93
- mapfile -t paths < <(printf '%s\n' "${{ steps.find.outputs.bundles }}")
94
- # Filter out any empty lines
95
- cleaned=()
96
- for p in "${paths[@]}"; do
97
- [ -n "$p" ] && cleaned+=("$p")
98
- done
99
- if [ ${#cleaned[@]} -gt 0 ]; then
100
- gh release upload "${{ inputs.tag }}" "${cleaned[@]}" --repo "${{ github.repository }}"
101
- else
102
- echo "No new bundles to upload."
103
- fi
39
+ subject-path : |
40
+ dist/*.tar.gz
41
+ dist/*.whl
0 commit comments