Skip to content

Commit f71fd33

Browse files
authored
fix(ci): prune stale devel wheel assets (#332)
1 parent d832a40 commit f71fd33

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

.github/workflows/release-dev.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,31 @@ jobs:
334334
git tag -fa devel -m "Latest Devel" "${GITHUB_SHA}"
335335
git push --force origin devel
336336
337+
- name: Prune stale wheel assets from devel release
338+
env:
339+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
340+
WHEEL_VERSION: ${{ needs.build-python-wheels.outputs.wheel_version }}
341+
run: |
342+
set -euo pipefail
343+
CURRENT_PREFIX="openshell-${WHEEL_VERSION}-"
344+
345+
if ! gh release view devel --repo "${GITHUB_REPOSITORY}" --json assets > /dev/null 2>&1; then
346+
echo "No existing devel release found; skipping wheel pruning."
347+
exit 0
348+
fi
349+
350+
gh release view devel --repo "${GITHUB_REPOSITORY}" --json assets --jq '.assets[].name' \
351+
| while read -r asset; do
352+
case "$asset" in
353+
*.whl)
354+
if [[ "$asset" != "${CURRENT_PREFIX}"* ]]; then
355+
echo "Deleting stale wheel asset: $asset"
356+
gh release delete-asset devel "$asset" --repo "${GITHUB_REPOSITORY}" --yes
357+
fi
358+
;;
359+
esac
360+
done
361+
337362
- name: Create / update GitHub Release
338363
uses: softprops/action-gh-release@v2
339364
with:

0 commit comments

Comments
 (0)