fix: 改进 Release 创建步骤的调试输出
This commit is contained in:
@@ -55,8 +55,12 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
VERSION=${{ env.VERSION }}
|
VERSION=${{ env.VERSION }}
|
||||||
REPO="${{ github.repository }}"
|
REPO="${{ github.repository }}"
|
||||||
|
|
||||||
|
# 使用 GITHUB_TOKEN (Gitea 自动提供)
|
||||||
TOKEN="${{ secrets.ACTIONS_TOKEN }}"
|
TOKEN="${{ secrets.ACTIONS_TOKEN }}"
|
||||||
|
|
||||||
|
echo "Creating release for $VERSION..."
|
||||||
|
|
||||||
# 检查 Release 是否已存在
|
# 检查 Release 是否已存在
|
||||||
EXISTING=$(curl -s -H "Authorization: token $TOKEN" "https://gitea.kg8.net/api/v1/repos/$REPO/releases/tags/$VERSION")
|
EXISTING=$(curl -s -H "Authorization: token $TOKEN" "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)
|
RELEASE_ID=$(echo "$EXISTING" | grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2)
|
||||||
@@ -67,8 +71,20 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# 创建新的 Release
|
# 创建新的 Release
|
||||||
RESPONSE=$(curl -s -X POST "https://gitea.kg8.net/api/v1/repos/$REPO/releases" -H "Authorization: token $TOKEN" -H "Content-Type: application/json" -d "{\"tag_name\":\"$VERSION\",\"name\":\"Release $VERSION\",\"draft\":false,\"prerelease\":false}")
|
RESPONSE=$(curl -s -X POST "https://gitea.kg8.net/api/v1/repos/$REPO/releases" \
|
||||||
|
-H "Authorization: token $TOKEN" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"tag_name\":\"$VERSION\",\"name\":\"Release $VERSION\",\"draft\":false,\"prerelease\":false}")
|
||||||
|
|
||||||
|
echo "Response: $RESPONSE"
|
||||||
|
|
||||||
NEW_RELEASE_ID=$(echo "$RESPONSE" | grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2)
|
NEW_RELEASE_ID=$(echo "$RESPONSE" | grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2)
|
||||||
|
|
||||||
|
if [ -z "$NEW_RELEASE_ID" ]; then
|
||||||
|
echo "❌ Failed to create release"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "release_id=$NEW_RELEASE_ID" >> $GITHUB_OUTPUT
|
echo "release_id=$NEW_RELEASE_ID" >> $GITHUB_OUTPUT
|
||||||
echo "✅ Release 创建成功 (ID: $NEW_RELEASE_ID)"
|
echo "✅ Release 创建成功 (ID: $NEW_RELEASE_ID)"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user