From 3cac1d53420e9c27af3f8f29430b9ea170ae9244 Mon Sep 17 00:00:00 2001 From: Reasonix Date: Fri, 14 Aug 2026 17:02:46 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E4=B8=8A=E4=BC=A0=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E5=89=8D=E5=88=A0=E9=99=A4=E5=90=8C=E5=90=8D=E6=97=A7=E9=99=84?= =?UTF-8?q?=E4=BB=B6=EF=BC=88=E9=98=B2=E6=AD=A2=E9=87=8D=E5=A4=8D=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/auto-release.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/auto-release.yml b/.gitea/workflows/auto-release.yml index fd371f9..32018a5 100644 --- a/.gitea/workflows/auto-release.yml +++ b/.gitea/workflows/auto-release.yml @@ -62,7 +62,18 @@ jobs: shell: bash run: | ID="${{ steps.release.outputs.release_id }}" - curl -s -X POST \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -F "attachment=@dsh-desktop-online.zip" \ - "https://git.vanusys.com/api/v1/repos/${{ github.repository }}/releases/${ID}/assets" + API="https://git.vanusys.com/api/v1/repos/${{ github.repository }}" + AUTH="Authorization: token ${{ secrets.GITHUB_TOKEN }}" + # remove same-name old assets first + curl -s -H "$AUTH" "$API/releases/${ID}/assets" -o assets.json + python -c " +import json +for a in json.load(open('assets.json')): + if a['name'] == 'dsh-desktop-online.zip': + print(a['id']) +" > old_ids.txt + while read AID; do + curl -s -X DELETE -H "$AUTH" "$API/releases/${ID}/assets/${AID}" -o /dev/null + echo "deleted old asset $AID" + done < old_ids.txt + curl -s -X POST -H "$AUTH" -F "attachment=@dsh-desktop-online.zip" "$API/releases/${ID}/assets"