Skip to content

Commit bcbc259

Browse files
committed
ci(release): filter PyPI artifact checks to wheel/sdist files
Restrict local artifact listing to .whl and .tar.gz files so stray non-package files in bundle/python don't cause spurious mismatches, and reuse that filtered list when hashing artifacts for the completeness check instead of globbing the directory directly.
1 parent ca9dea2 commit bcbc259

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ jobs:
181181
release_json() { curl -fsSL "https://pypi.org/pypi/$project/$version/json"; }
182182
check_hashes() {
183183
local json="$1" file name local_hash remote_hash
184-
mapfile -t local_names < <(find bundle/python -maxdepth 1 -type f -printf '%f\n' | sort)
184+
mapfile -t local_names < <(find bundle/python -maxdepth 1 -type f \( -name '*.whl' -o -name '*.tar.gz' \) -printf '%f\n' | sort)
185185
mapfile -t remote_names < <(jq -r '.urls[].filename' <<<"$json" | sort)
186186
for name in "${remote_names[@]}"; do
187187
printf '%s\n' "${local_names[@]}" | grep -Fxq "$name" || { echo "unexpected PyPI artifact $name" >&2; return 1; }
@@ -202,12 +202,12 @@ jobs:
202202
set -euo pipefail
203203
for attempt in {1..90}; do
204204
if json="$(curl -fsSL -H 'Cache-Control: no-cache' "https://pypi.org/pypi/code2graph-rs/${{ needs.validate.outputs.python_version }}/json?attempt=$attempt" 2>/dev/null)"; then
205-
mapfile -t local_names < <(find bundle/python -maxdepth 1 -type f -printf '%f\n' | sort)
205+
mapfile -t local_names < <(find bundle/python -maxdepth 1 -type f \( -name '*.whl' -o -name '*.tar.gz' \) -printf '%f\n' | sort)
206206
mapfile -t remote_names < <(jq -r '.urls[].filename' <<<"$json" | sort)
207207
complete=true
208208
test "${local_names[*]}" = "${remote_names[*]}" || complete=false
209-
for file in bundle/python/*; do
210-
name="$(basename "$file")"; hash="$(sha256sum "$file" | awk '{print $1}')"
209+
for name in "${local_names[@]}"; do
210+
hash="$(sha256sum "bundle/python/$name" | awk '{print $1}')"
211211
test "$(jq -r --arg name "$name" '.urls[] | select(.filename == $name) | .digests.sha256' <<<"$json")" = "$hash" || complete=false
212212
done
213213
"$complete" && exit 0

0 commit comments

Comments
 (0)