fix(ci): purge stale release assets before attaching fresh binaries for idempotency
Build and Publish Release / Build Packages and Publish (push) Successful in 15s
Build and Publish Release / Build Packages and Publish (push) Successful in 15s
This commit is contained in:
1 parent
63120e4793
commit
d5cf44cb57
1 file changed
+10
@@ -99,6 +99,16 @@ jobs:
|
|||||||
echo "Release ID: $REL_ID"
|
echo "Release ID: $REL_ID"
|
||||||
|
|
||||||
if [ -n "$REL_ID" ]; then
|
if [ -n "$REL_ID" ]; then
|
||||||
|
# Clean up any existing assets for this release (ensures idempotency on re-runs)
|
||||||
|
EXISTING_ASSETS=$(curl -k -s -H "Authorization: token ${GITHUB_TOKEN}" \
|
||||||
|
"${SERVER_URL}/api/v1/repos/${REPO}/releases/${REL_ID}/assets" || true)
|
||||||
|
ASSET_IDS=$(python3 -c "import sys, json; print(' '.join(str(a['id']) for a in json.loads(sys.argv[1])))" "$EXISTING_ASSETS" 2>/dev/null || true)
|
||||||
|
for aid in $ASSET_IDS; do
|
||||||
|
echo "Removing previous asset ID $aid..."
|
||||||
|
curl -k -s -X DELETE -H "Authorization: token ${GITHUB_TOKEN}" \
|
||||||
|
"${SERVER_URL}/api/v1/repos/${REPO}/releases/${REL_ID}/assets/${aid}" || true
|
||||||
|
done
|
||||||
|
|
||||||
# Target only user-facing binaries (exclude internal rpm SOURCES and SRPMS)
|
# Target only user-facing binaries (exclude internal rpm SOURCES and SRPMS)
|
||||||
ASSET_FILES=(
|
ASSET_FILES=(
|
||||||
$(ls dist/*.tar.gz 2>/dev/null || true)
|
$(ls dist/*.tar.gz 2>/dev/null || true)
|
||||||
|
|||||||
Reference in new issue
Block a user