Update .gitea/workflows/docker-build.yml

This commit is contained in:
cal 2026-02-04 06:43:59 +00:00
parent cd1b485946
commit 6eece9f1db

View File

@ -147,50 +147,92 @@ jobs:
fi
- name: Discord Notification - Success
if: success() && github.ref == 'refs/heads/main'
if: success() && github.ref == 'refs/heads/main'
run: |
curl -H "Content-Type: application/json" \
-d '{
"embeds": [{
"title": "✅ Paper Dynasty Build Successful",
"description": "Docker image built and ready to deploy!",
"color": 3066993,
"fields": [
{
"name": "Version",
"value": "`v${{ steps.meta.outputs.version }}`",
"inline": true
},
{
"name": "Image Tag",
"value": "`${{ steps.meta.outputs.version_sha }}`",
"inline": true
},
{
"name": "Branch",
"value": "`${{ steps.meta.outputs.branch }}`",
"inline": true
},
{
"name": "Commit",
"value": "`${{ steps.meta.outputs.sha_short }}`",
"inline": true
},
{
"name": "Author",
"value": "${{ github.actor }}",
"inline": true
},
{
"name": "View Run",
"value": "[Click here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})",
"inline": false
}
],
"timestamp": "${{ steps.meta.outputs.timestamp }}"
}]
}' \
https://discord.com/api/webhooks/1468485116631453840/JALtLV8dO2IWso3tNcntHW8wDgQeMZuLgFKVUeoEY9ig_OPjjm4PmjvzwYebH5l7_Nxv
# Debug: Show what variables we have
echo "=== Debug Info ==="
echo "Version: ${{ steps.meta.outputs.version }}"
echo "Version SHA: ${{ steps.meta.outputs.version_sha }}"
echo "SHA Short: ${{ steps.meta.outputs.sha_short }}"
echo "Branch: ${{ steps.meta.outputs.branch }}"
echo "Timestamp: ${{ steps.meta.outputs.timestamp }}"
echo "Actor: ${{ github.actor }}"
echo ""
# Build the JSON payload
PAYLOAD=$(cat <<EOF
{
"embeds": [{
"title": "✅ Paper Dynasty Build Successful",
"description": "Docker image built and pushed to Docker Hub!",
"color": 3066993,
"fields": [
{
"name": "Version",
"value": "\`v${{ steps.meta.outputs.version }}\`",
"inline": true
},
{
"name": "Image Tag",
"value": "\`${{ steps.meta.outputs.version_sha }}\`",
"inline": true
},
{
"name": "Branch",
"value": "\`${{ steps.meta.outputs.branch }}\`",
"inline": true
},
{
"name": "Commit",
"value": "\`${{ steps.meta.outputs.sha_short }}\`",
"inline": true
},
{
"name": "Author",
"value": "${{ github.actor }}",
"inline": true
},
{
"name": "Docker Hub",
"value": "[manticorum67/paper-dynasty](https://hub.docker.com/r/manticorum67/paper-dynasty)",
"inline": false
},
{
"name": "View Run",
"value": "[Click here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})",
"inline": false
}
],
"timestamp": "${{ steps.meta.outputs.timestamp }}"
}]
}
EOF
)
echo "=== Sending to Discord ==="
echo "$PAYLOAD"
echo ""
# Send to Discord and capture response
RESPONSE=$(curl -s -w "\nHTTP_CODE:%{http_code}" \
-H "Content-Type: application/json" \
-d "$PAYLOAD" \
https://discord.com/api/webhooks/1468485116631453840/JALtLV8dO2IWso3tNcntHW8wDgQeMZuLgFKVUeoEY9ig_OPjjm4PmjvzwYebH5l7_Nxv)
HTTP_CODE=$(echo "$RESPONSE" | grep "HTTP_CODE:" | cut -d: -f2)
BODY=$(echo "$RESPONSE" | sed '/HTTP_CODE:/d')
echo "=== Response ==="
echo "HTTP Code: $HTTP_CODE"
echo "Response Body: $BODY"
if [ "$HTTP_CODE" != "204" ] && [ "$HTTP_CODE" != "200" ]; then
echo "❌ Discord webhook failed with HTTP $HTTP_CODE"
exit 1
else
echo "✅ Discord notification sent successfully"
fi
- name: Discord Notification - Failure
if: failure() && github.ref == 'refs/heads/main'