Skip to content

Commit ab70440

Browse files
committed
fix(ci): generate SHA256SUMS with basenames and make TestPyPI publish idempotent
Assisted-by: Claude Opus 4.8
1 parent 9c7324a commit ab70440

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

.github/workflows/release-rc.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ jobs:
5353
uses: pypa/gh-action-pypi-publish@release/v1
5454
with:
5555
repository-url: https://test.pypi.org/legacy/
56+
# RC validation may be re-run on the same version (e.g. after fixing
57+
# a later job). TestPyPI versions are immutable, so skip already
58+
# uploaded files instead of failing the whole workflow.
59+
skip-existing: true
5660

5761
github-prerelease:
5862
needs: build
@@ -90,10 +94,14 @@ jobs:
9094
- name: Generate SHA256SUMS
9195
run: |
9296
cd assets
97+
# Published release assets are flat, so SHA256SUMS must reference bare
98+
# filenames. Run sha256sum from each file's own directory so the
99+
# checksum line contains the basename (not dists/…, msi/…, pdfs/…).
93100
find dists msi pdfs -type f \
94101
\( -name '*.whl' -o -name '*.tar.gz' -o -name '*.msi' -o -name '*.pdf' \) \
95-
-printf '%P\n' | sort | xargs -I{} sha256sum {} \
96-
> SHA256SUMS
102+
-printf '%p\n' | sort | while read -r f; do
103+
( cd "$(dirname "$f")" && sha256sum "$(basename "$f")" )
104+
done > SHA256SUMS
97105
cat SHA256SUMS
98106
99107
- name: Attest build provenance

.github/workflows/release.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,14 @@ jobs:
100100
# release. Users verify with: `sha256sum -c SHA256SUMS`.
101101
run: |
102102
cd assets
103+
# Published release assets are flat, so SHA256SUMS must reference bare
104+
# filenames. Run sha256sum from each file's own directory so the
105+
# checksum line contains the basename (not dists/…, msi/…, pdfs/…).
103106
find dists msi pdfs -type f \
104107
\( -name '*.whl' -o -name '*.tar.gz' -o -name '*.msi' -o -name '*.pdf' \) \
105-
-printf '%P\n' | sort | xargs -I{} sha256sum {} \
106-
> SHA256SUMS
108+
-printf '%p\n' | sort | while read -r f; do
109+
( cd "$(dirname "$f")" && sha256sum "$(basename "$f")" )
110+
done > SHA256SUMS
107111
echo "--- SHA256SUMS ---"
108112
cat SHA256SUMS
109113

0 commit comments

Comments
 (0)