Add authentication and error logging to release creation
- Add Authorization header using GITHUB_TOKEN - Remove silent fail flag to see error responses - Log API responses for debugging Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
9719fc05f7
commit
95a82321ee
1 changed files with 11 additions and 5 deletions
|
|
@ -104,13 +104,15 @@ jobs:
|
|||
ls -lh "$GITHUB_WORKSPACE/$TARBALL"
|
||||
|
||||
- name: Create release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
TARBALL="docs-${VERSION}.tar.gz"
|
||||
|
||||
echo "Creating release $VERSION..."
|
||||
|
||||
# Use Forgejo API to create release
|
||||
# Use Forgejo API to create release (requires authentication)
|
||||
RELEASE_DATA=$(cat <<EOF
|
||||
{
|
||||
"tag_name": "$VERSION",
|
||||
|
|
@ -122,17 +124,19 @@ jobs:
|
|||
EOF
|
||||
)
|
||||
|
||||
RELEASE_RESPONSE=$(curl -sf \
|
||||
RELEASE_RESPONSE=$(curl -s \
|
||||
-X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: token $GITHUB_TOKEN" \
|
||||
-d "$RELEASE_DATA" \
|
||||
"https://forge.ops.eblu.me/api/v1/repos/eblume/blumeops/releases")
|
||||
|
||||
echo "API Response: $RELEASE_RESPONSE"
|
||||
|
||||
RELEASE_ID=$(echo "$RELEASE_RESPONSE" | jq -r '.id')
|
||||
|
||||
if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "null" ]; then
|
||||
echo "Error: Failed to create release"
|
||||
echo "Response: $RELEASE_RESPONSE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
@ -140,12 +144,14 @@ jobs:
|
|||
|
||||
# Upload the asset
|
||||
echo "Uploading $TARBALL..."
|
||||
curl -sf \
|
||||
UPLOAD_RESPONSE=$(curl -s \
|
||||
-X POST \
|
||||
-H "Content-Type: application/gzip" \
|
||||
-H "Authorization: token $GITHUB_TOKEN" \
|
||||
--data-binary "@$TARBALL" \
|
||||
"https://forge.ops.eblu.me/api/v1/repos/eblume/blumeops/releases/$RELEASE_ID/assets?name=$TARBALL"
|
||||
"https://forge.ops.eblu.me/api/v1/repos/eblume/blumeops/releases/$RELEASE_ID/assets?name=$TARBALL")
|
||||
|
||||
echo "Upload Response: $UPLOAD_RESPONSE"
|
||||
echo ""
|
||||
echo "Release created successfully!"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue