You've already forked wc-licensed-product
Fix Gitea release workflow to use API directly
Some checks failed
Create Release Package / build-release (push) Has been cancelled
Some checks failed
Create Release Package / build-release (push) Has been cancelled
Replace non-existent actions/gitea-release-action with direct Gitea API calls using curl for release creation and asset upload. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -150,13 +150,62 @@ jobs:
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Create Gitea Release
|
||||
uses: actions/gitea-release-action@v1
|
||||
with:
|
||||
token: ${{ secrets.SRC_GITEA_TOKEN }}
|
||||
tag: ${{ github.ref_name }}
|
||||
title: "v${{ steps.version.outputs.version }}"
|
||||
body: ${{ steps.changelog.outputs.changelog }}
|
||||
prerelease: ${{ contains(github.ref_name, '-') }}
|
||||
files: |
|
||||
releases/wc-licensed-product-${{ steps.version.outputs.version }}.zip
|
||||
releases/wc-licensed-product-${{ steps.version.outputs.version }}.zip.sha256
|
||||
id: create_release
|
||||
run: |
|
||||
VERSION=${{ steps.version.outputs.version }}
|
||||
TAG_NAME=${{ github.ref_name }}
|
||||
|
||||
# Determine if prerelease
|
||||
if [[ "$TAG_NAME" == *"-"* ]]; then
|
||||
PRERELEASE=true
|
||||
else
|
||||
PRERELEASE=false
|
||||
fi
|
||||
|
||||
# Escape changelog for JSON
|
||||
CHANGELOG_ESCAPED=$(echo '${{ steps.changelog.outputs.changelog }}' | jq -Rs .)
|
||||
|
||||
# Create release via Gitea API
|
||||
RESPONSE=$(curl -s -X POST \
|
||||
-H "Authorization: token ${{ secrets.SRC_GITEA_TOKEN }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases" \
|
||||
-d "{
|
||||
\"tag_name\": \"${TAG_NAME}\",
|
||||
\"name\": \"v${VERSION}\",
|
||||
\"body\": ${CHANGELOG_ESCAPED},
|
||||
\"draft\": false,
|
||||
\"prerelease\": ${PRERELEASE}
|
||||
}")
|
||||
|
||||
# Extract release ID
|
||||
RELEASE_ID=$(echo "$RESPONSE" | jq -r '.id')
|
||||
echo "Release ID: $RELEASE_ID"
|
||||
echo "release_id=$RELEASE_ID" >> $GITHUB_OUTPUT
|
||||
|
||||
if [ "$RELEASE_ID" == "null" ] || [ -z "$RELEASE_ID" ]; then
|
||||
echo "Failed to create release"
|
||||
echo "$RESPONSE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Upload Release Assets
|
||||
run: |
|
||||
VERSION=${{ steps.version.outputs.version }}
|
||||
RELEASE_ID=${{ steps.create_release.outputs.release_id }}
|
||||
|
||||
# Upload zip file
|
||||
curl -s -X POST \
|
||||
-H "Authorization: token ${{ secrets.SRC_GITEA_TOKEN }}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=wc-licensed-product-${VERSION}.zip" \
|
||||
--data-binary @"releases/wc-licensed-product-${VERSION}.zip"
|
||||
|
||||
# Upload checksum file
|
||||
curl -s -X POST \
|
||||
-H "Authorization: token ${{ secrets.SRC_GITEA_TOKEN }}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=wc-licensed-product-${VERSION}.zip.sha256" \
|
||||
--data-binary @"releases/wc-licensed-product-${VERSION}.zip.sha256"
|
||||
|
||||
echo "Assets uploaded successfully"
|
||||
|
||||
Reference in New Issue
Block a user