From 0883fb93706abdde42aece09d6be6688e17f4c7d Mon Sep 17 00:00:00 2001 From: EUForest Date: Mon, 9 Feb 2026 01:12:20 +0800 Subject: [PATCH] fix(ci): handle existing releases and assets in deploy workflow - Check if release exists before creating - Delete old assets if they exist - Use --clobber flag to overwrite existing assets - Prevent 'already exists' errors on tag force-push --- .github/workflows/deploy-linux.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-linux.yml b/.github/workflows/deploy-linux.yml index 5fc3bb7..1996507 100644 --- a/.github/workflows/deploy-linux.yml +++ b/.github/workflows/deploy-linux.yml @@ -62,5 +62,18 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | VERSION=${GITHUB_REF#refs/tags/} - gh release create $VERSION --title "PPanel Server $VERSION" || true - gh release upload $VERSION ppanel-server-${VERSION}-linux-amd64.tar.gz checksum.txt + + # Check if release exists + if gh release view $VERSION >/dev/null 2>&1; then + echo "Release $VERSION already exists, deleting old assets..." + # Delete existing assets if they exist + gh release delete-asset $VERSION ppanel-server-${VERSION}-linux-amd64.tar.gz --yes 2>/dev/null || true + gh release delete-asset $VERSION checksum.txt --yes 2>/dev/null || true + else + echo "Creating new release $VERSION..." + gh release create $VERSION --title "PPanel Server $VERSION" --notes "Release $VERSION" + fi + + # Upload assets (will overwrite if --clobber is supported, otherwise will fail gracefully) + echo "Uploading assets..." + gh release upload $VERSION ppanel-server-${VERSION}-linux-amd64.tar.gz checksum.txt --clobber