Update .gitea/workflows/docker-build.yml
This commit is contained in:
parent
cd1b485946
commit
6eece9f1db
@ -147,50 +147,92 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Discord Notification - Success
|
- name: Discord Notification - Success
|
||||||
if: success() && github.ref == 'refs/heads/main'
|
if: success() && github.ref == 'refs/heads/main'
|
||||||
run: |
|
run: |
|
||||||
curl -H "Content-Type: application/json" \
|
# Debug: Show what variables we have
|
||||||
-d '{
|
echo "=== Debug Info ==="
|
||||||
"embeds": [{
|
echo "Version: ${{ steps.meta.outputs.version }}"
|
||||||
"title": "✅ Paper Dynasty Build Successful",
|
echo "Version SHA: ${{ steps.meta.outputs.version_sha }}"
|
||||||
"description": "Docker image built and ready to deploy!",
|
echo "SHA Short: ${{ steps.meta.outputs.sha_short }}"
|
||||||
"color": 3066993,
|
echo "Branch: ${{ steps.meta.outputs.branch }}"
|
||||||
"fields": [
|
echo "Timestamp: ${{ steps.meta.outputs.timestamp }}"
|
||||||
{
|
echo "Actor: ${{ github.actor }}"
|
||||||
"name": "Version",
|
echo ""
|
||||||
"value": "`v${{ steps.meta.outputs.version }}`",
|
|
||||||
"inline": true
|
# Build the JSON payload
|
||||||
},
|
PAYLOAD=$(cat <<EOF
|
||||||
{
|
{
|
||||||
"name": "Image Tag",
|
"embeds": [{
|
||||||
"value": "`${{ steps.meta.outputs.version_sha }}`",
|
"title": "✅ Paper Dynasty Build Successful",
|
||||||
"inline": true
|
"description": "Docker image built and pushed to Docker Hub!",
|
||||||
},
|
"color": 3066993,
|
||||||
{
|
"fields": [
|
||||||
"name": "Branch",
|
{
|
||||||
"value": "`${{ steps.meta.outputs.branch }}`",
|
"name": "Version",
|
||||||
"inline": true
|
"value": "\`v${{ steps.meta.outputs.version }}\`",
|
||||||
},
|
"inline": true
|
||||||
{
|
},
|
||||||
"name": "Commit",
|
{
|
||||||
"value": "`${{ steps.meta.outputs.sha_short }}`",
|
"name": "Image Tag",
|
||||||
"inline": true
|
"value": "\`${{ steps.meta.outputs.version_sha }}\`",
|
||||||
},
|
"inline": true
|
||||||
{
|
},
|
||||||
"name": "Author",
|
{
|
||||||
"value": "${{ github.actor }}",
|
"name": "Branch",
|
||||||
"inline": true
|
"value": "\`${{ steps.meta.outputs.branch }}\`",
|
||||||
},
|
"inline": true
|
||||||
{
|
},
|
||||||
"name": "View Run",
|
{
|
||||||
"value": "[Click here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})",
|
"name": "Commit",
|
||||||
"inline": false
|
"value": "\`${{ steps.meta.outputs.sha_short }}\`",
|
||||||
}
|
"inline": true
|
||||||
],
|
},
|
||||||
"timestamp": "${{ steps.meta.outputs.timestamp }}"
|
{
|
||||||
}]
|
"name": "Author",
|
||||||
}' \
|
"value": "${{ github.actor }}",
|
||||||
https://discord.com/api/webhooks/1468485116631453840/JALtLV8dO2IWso3tNcntHW8wDgQeMZuLgFKVUeoEY9ig_OPjjm4PmjvzwYebH5l7_Nxv
|
"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
|
- name: Discord Notification - Failure
|
||||||
if: failure() && github.ref == 'refs/heads/main'
|
if: failure() && github.ref == 'refs/heads/main'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user