Delete old dev builds
All checks were successful
Source release / source-package (push) Successful in 2m22s
All checks were successful
Source release / source-package (push) Successful in 2m22s
This commit is contained in:
@@ -283,6 +283,32 @@ jobs:
|
||||
|
||||
echo "$RELEASE_JSON" > release.json
|
||||
|
||||
- name: Delete old development assets
|
||||
if: ${{ steps.target.outputs.tag == 'development' }}
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
run: |
|
||||
set -e
|
||||
|
||||
RELEASE_ID="$(jq -r '.id' release.json)"
|
||||
|
||||
ASSET_IDS="$(curl -fsS \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"${GITEA_API}/repos/${OWNER}/${REPO}/releases/${RELEASE_ID}" \
|
||||
| jq -r '.assets[]? | .id')"
|
||||
|
||||
if [ -z "$ASSET_IDS" ]; then
|
||||
echo "No old development assets to delete."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for ASSET_ID in $ASSET_IDS; do
|
||||
echo "Deleting old development asset id=${ASSET_ID}"
|
||||
curl -fsS -X DELETE \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"${GITEA_API}/repos/${OWNER}/${REPO}/releases/${RELEASE_ID}/assets/${ASSET_ID}"
|
||||
done
|
||||
|
||||
- name: Delete old asset with same name if present
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
@@ -319,4 +345,4 @@ jobs:
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary @"${FILE}" \
|
||||
"${GITEA_API}/repos/${OWNER}/${REPO}/releases/${RELEASE_ID}/assets?name=${NAME}"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user