This commit is contained in:
@@ -51,6 +51,8 @@ jobs:
|
||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||
|
||||
- name: Create Release and Upload APK
|
||||
env:
|
||||
AUTH: ${{ secrets.AUTHB64 }}
|
||||
run: |
|
||||
VERSION=${{ env.VERSION }}
|
||||
APK_FILE=${{ env.APK_FILE }}
|
||||
@@ -59,18 +61,18 @@ jobs:
|
||||
echo "Creating release for $VERSION..."
|
||||
|
||||
# 删除已存在的 release
|
||||
EXISTING=$(curl -s -u "amos:Aimi12138!" "https://gitea.kg8.net/api/v1/repos/$REPO/releases/tags/$VERSION")
|
||||
EXISTING=$(curl -s -H "Authorization: Basic $AUTH" "https://gitea.kg8.net/api/v1/repos/$REPO/releases/tags/$VERSION")
|
||||
RELEASE_ID=$(echo "$EXISTING" | grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2)
|
||||
|
||||
if [ -n "$RELEASE_ID" ]; then
|
||||
echo "删除已存在的 Release (ID: $RELEASE_ID)"
|
||||
curl -s -X DELETE -u "amos:Aimi12138!" "https://gitea.kg8.net/api/v1/repos/$REPO/releases/$RELEASE_ID"
|
||||
curl -s -X DELETE -H "Authorization: Basic $AUTH" "https://gitea.kg8.net/api/v1/repos/$REPO/releases/$RELEASE_ID"
|
||||
sleep 2
|
||||
fi
|
||||
|
||||
# 创建新的 Release
|
||||
RESPONSE=$(curl -s -X POST "https://gitea.kg8.net/api/v1/repos/$REPO/releases" \
|
||||
-u "amos:Aimi12138!" \
|
||||
-H "Authorization: Basic $AUTH" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\":\"$VERSION\",\"name\":\"Release $VERSION\",\"draft\":false,\"prerelease\":false}")
|
||||
|
||||
@@ -88,7 +90,7 @@ jobs:
|
||||
# 上传 APK
|
||||
echo "Uploading APK: $APK_FILE"
|
||||
UPLOAD_RESPONSE=$(curl -s -X POST "https://gitea.kg8.net/api/v1/repos/$REPO/releases/$RELEASE_ID/assets" \
|
||||
-u "amos:Aimi12138!" \
|
||||
-H "Authorization: Basic $AUTH" \
|
||||
-F "attachment=@$APK_FILE")
|
||||
|
||||
echo "Upload Response: $UPLOAD_RESPONSE"
|
||||
|
||||
Reference in New Issue
Block a user