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"
|
ls -lh "$GITHUB_WORKSPACE/$TARBALL"
|
||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
VERSION="${{ steps.version.outputs.version }}"
|
VERSION="${{ steps.version.outputs.version }}"
|
||||||
TARBALL="docs-${VERSION}.tar.gz"
|
TARBALL="docs-${VERSION}.tar.gz"
|
||||||
|
|
||||||
echo "Creating release $VERSION..."
|
echo "Creating release $VERSION..."
|
||||||
|
|
||||||
# Use Forgejo API to create release
|
# Use Forgejo API to create release (requires authentication)
|
||||||
RELEASE_DATA=$(cat <<EOF
|
RELEASE_DATA=$(cat <<EOF
|
||||||
{
|
{
|
||||||
"tag_name": "$VERSION",
|
"tag_name": "$VERSION",
|
||||||
|
|
@ -122,17 +124,19 @@ jobs:
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
|
|
||||||
RELEASE_RESPONSE=$(curl -sf \
|
RELEASE_RESPONSE=$(curl -s \
|
||||||
-X POST \
|
-X POST \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
|
-H "Authorization: token $GITHUB_TOKEN" \
|
||||||
-d "$RELEASE_DATA" \
|
-d "$RELEASE_DATA" \
|
||||||
"https://forge.ops.eblu.me/api/v1/repos/eblume/blumeops/releases")
|
"https://forge.ops.eblu.me/api/v1/repos/eblume/blumeops/releases")
|
||||||
|
|
||||||
|
echo "API Response: $RELEASE_RESPONSE"
|
||||||
|
|
||||||
RELEASE_ID=$(echo "$RELEASE_RESPONSE" | jq -r '.id')
|
RELEASE_ID=$(echo "$RELEASE_RESPONSE" | jq -r '.id')
|
||||||
|
|
||||||
if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "null" ]; then
|
if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "null" ]; then
|
||||||
echo "Error: Failed to create release"
|
echo "Error: Failed to create release"
|
||||||
echo "Response: $RELEASE_RESPONSE"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -140,12 +144,14 @@ jobs:
|
||||||
|
|
||||||
# Upload the asset
|
# Upload the asset
|
||||||
echo "Uploading $TARBALL..."
|
echo "Uploading $TARBALL..."
|
||||||
curl -sf \
|
UPLOAD_RESPONSE=$(curl -s \
|
||||||
-X POST \
|
-X POST \
|
||||||
-H "Content-Type: application/gzip" \
|
-H "Content-Type: application/gzip" \
|
||||||
|
-H "Authorization: token $GITHUB_TOKEN" \
|
||||||
--data-binary "@$TARBALL" \
|
--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 ""
|
||||||
echo "Release created successfully!"
|
echo "Release created successfully!"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue