From e3c40c822b7c8a74a870cd78bbc58019d6caec1a Mon Sep 17 00:00:00 2001 From: 7iwind <7wind@7iwind.cn> Date: Sun, 26 Jul 2026 15:06:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E6=89=93=E5=8C=85?= =?UTF-8?q?=E5=90=8E=E7=9A=84=E7=9B=AE=E5=BD=95=E7=BB=93=E6=9E=84=EF=BC=8C?= =?UTF-8?q?=E4=BE=BF=E4=BA=8E=E5=BC=95=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/release.yml | 26 ++++++++++++++++++-------- .idea/ctestState.xml | 1 - 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index b405730..fb53f46 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -55,22 +55,32 @@ jobs: run: | TAG="${{ steps.tag.outputs.tag }}" API="${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases" + TOKEN="${{ gitea.token }}" - echo "=== Creating release $TAG ===" - RESP=$(curl -s -X POST \ - -H "Authorization: token ${{ gitea.token }}" \ - -H "Content-Type: application/json" \ - -d "{\"tag_name\":\"${TAG}\",\"name\":\"DataRouter ${TAG}\"}" \ - "$API") + # Check if release already exists + echo "=== Checking existing releases for $TAG ===" + EXISTING=$(curl -s -H "Authorization: token ${TOKEN}" "${API}" | \ + python3 -c "import sys,json;rels=json.load(sys.stdin);print(next((r['id'] for r in rels if r['tag_name']=='${TAG}'),''))") - ID=$(echo "$RESP" | python3 -c "import sys,json;print(json.load(sys.stdin)['id'])") + if [ -n "$EXISTING" ]; then + ID="$EXISTING" + echo "Release already exists (ID=$ID), updating it" + else + echo "=== Creating release $TAG ===" + RESP=$(curl -s -X POST \ + -H "Authorization: token ${TOKEN}" \ + -H "Content-Type: application/json" \ + -d "{\"tag_name\":\"${TAG}\",\"name\":\"DataRouter ${TAG}\"}" \ + "$API") + ID=$(echo "$RESP" | python3 -c "import sys,json;d=json.loads(sys.stdin.read());print(d['id'])") + fi for dir in dist/*/; do name="$(basename "$dir").tar.gz" tar czf "/tmp/$name" -C "$dir" . echo "Uploading $name" curl -s -X POST \ - -H "Authorization: token ${{ gitea.token }}" \ + -H "Authorization: token ${TOKEN}" \ -H "Content-Type: application/octet-stream" \ --data-binary @"/tmp/$name" \ "${API}/${ID}/assets?name=${name}" diff --git a/.idea/ctestState.xml b/.idea/ctestState.xml index 61d31e4..b084f3d 100644 --- a/.idea/ctestState.xml +++ b/.idea/ctestState.xml @@ -2,7 +2,6 @@ -