Notify Discord after deploy workflows
This commit is contained in:
@@ -48,6 +48,29 @@ jobs:
|
|||||||
cd /docker/FlockPal-dev
|
cd /docker/FlockPal-dev
|
||||||
docker compose -f docker-compose.dev.yaml up -d --build
|
docker compose -f docker-compose.dev.yaml up -d --build
|
||||||
|
|
||||||
|
- name: Notify Discord
|
||||||
|
if: always()
|
||||||
|
env:
|
||||||
|
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||||
|
JOB_STATUS: ${{ job.status }}
|
||||||
|
DEPLOY_ENVIRONMENT: dev
|
||||||
|
run: |
|
||||||
|
if [ -z "$DISCORD_WEBHOOK_URL" ]; then
|
||||||
|
echo "DISCORD_WEBHOOK_URL is not configured; skipping Discord notification."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$JOB_STATUS" = "success" ]; then
|
||||||
|
STATUS_LABEL="SUCCESS"
|
||||||
|
else
|
||||||
|
STATUS_LABEL="FAILED"
|
||||||
|
fi
|
||||||
|
|
||||||
|
curl --fail --show-error --silent \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"content\":\"[${STATUS_LABEL}] FlockPal ${DEPLOY_ENVIRONMENT} deploy completed with status: ${JOB_STATUS}\\nBranch: ${{ github.ref_name }}\\nCommit: ${{ github.sha }}\\nRun: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}" \
|
||||||
|
"$DISCORD_WEBHOOK_URL" || echo "Discord notification failed."
|
||||||
|
|
||||||
deploy-prod:
|
deploy-prod:
|
||||||
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref_name == 'main') }}
|
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref_name == 'main') }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -92,3 +115,26 @@ jobs:
|
|||||||
set -e
|
set -e
|
||||||
cd /docker/FlockPal
|
cd /docker/FlockPal
|
||||||
docker compose -f docker-compose.prod.yml exec -T backend node dist/healthcheck.js api-ready
|
docker compose -f docker-compose.prod.yml exec -T backend node dist/healthcheck.js api-ready
|
||||||
|
|
||||||
|
- name: Notify Discord
|
||||||
|
if: always()
|
||||||
|
env:
|
||||||
|
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||||
|
JOB_STATUS: ${{ job.status }}
|
||||||
|
DEPLOY_ENVIRONMENT: production
|
||||||
|
run: |
|
||||||
|
if [ -z "$DISCORD_WEBHOOK_URL" ]; then
|
||||||
|
echo "DISCORD_WEBHOOK_URL is not configured; skipping Discord notification."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$JOB_STATUS" = "success" ]; then
|
||||||
|
STATUS_LABEL="SUCCESS"
|
||||||
|
else
|
||||||
|
STATUS_LABEL="FAILED"
|
||||||
|
fi
|
||||||
|
|
||||||
|
curl --fail --show-error --silent \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"content\":\"[${STATUS_LABEL}] FlockPal ${DEPLOY_ENVIRONMENT} deploy completed with status: ${JOB_STATUS}\\nBranch: ${{ github.ref_name }}\\nCommit: ${{ github.sha }}\\nRun: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}" \
|
||||||
|
"$DISCORD_WEBHOOK_URL" || echo "Discord notification failed."
|
||||||
|
|||||||
Reference in New Issue
Block a user