Skip to content

Commit 92002a7

Browse files
committed
move action to old workflow file
1 parent c9bf6fe commit 92002a7

File tree

1 file changed

+10
-72
lines changed

1 file changed

+10
-72
lines changed

.github/workflows/sign-release-assets.yml

Lines changed: 10 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ on:
44
workflow_dispatch:
55
inputs:
66
tag:
7-
description: Git tag of the existing release
7+
description: Git tag of the existing release (e.g., v0.25.0)
88
required: true
99
type: string
1010

1111
permissions:
1212
contents: write
1313
id-token: write
14+
attestations: write
1415

1516
jobs:
16-
sign-and-upload:
17-
name: Sign and upload Sigstore bundles for release assets
17+
attest:
1818
runs-on: ubuntu-latest
1919
steps:
20-
- name: Create dist directory
20+
- name: Prepare dist directory
2121
run: mkdir -p dist
2222

2323
- name: Download assets from GitHub Release
@@ -28,76 +28,14 @@ jobs:
2828
'${{ inputs.tag }}'
2929
--repo '${{ github.repository }}'
3030
-D dist/
31+
-p '*.whl' -p '*.tar.gz'
3132
3233
- name: List downloaded files
3334
run: ls -lah dist || true
3435

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
8338
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

Comments
 (0)