diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 5d59100c..a7fc2d38 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -561,12 +561,42 @@ jobs: steps: - name: 🔔 Gotify run: | - STATUS="${{ needs.deploy.result }}" + DEPLOY="${{ needs.deploy.result }}" SMOKE="${{ needs.post_deploy_checks.result }}" - TITLE="klz-cables.com: deploy=$STATUS smoke=$SMOKE" - [[ "$STATUS" == "success" && "$SMOKE" == "success" ]] && PRIORITY=5 || PRIORITY=8 - + PERF="${{ needs.performance.result }}" + TARGET="${{ needs.prepare.outputs.target }}" + VERSION="${{ needs.prepare.outputs.image_tag }}" + URL="${{ needs.prepare.outputs.next_public_url }}" + + # Gotify priority scale: + # 1-3 = low (silent/info) + # 4-5 = normal + # 6-7 = high (warning) + # 8-10 = critical (alarm) + if [[ "$DEPLOY" != "success" ]]; then + PRIORITY=10 + EMOJI="🚨" + STATUS_LINE="DEPLOY FAILED" + elif [[ "$SMOKE" != "success" ]]; then + PRIORITY=8 + EMOJI="⚠️" + STATUS_LINE="Smoke tests failed" + elif [[ "$PERF" != "success" ]]; then + PRIORITY=5 + EMOJI="📉" + STATUS_LINE="Performance degraded" + else + PRIORITY=2 + EMOJI="✅" + STATUS_LINE="All checks passed" + fi + + TITLE="$EMOJI klz-cables.com $VERSION → $TARGET" + MESSAGE="$STATUS_LINE + Deploy: $DEPLOY | Smoke: $SMOKE | Perf: $PERF + $URL" + curl -s -k -X POST "${{ secrets.GOTIFY_URL }}/message?token=${{ secrets.GOTIFY_TOKEN }}" \ -F "title=$TITLE" \ - -F "message=Deploy to ${{ needs.prepare.outputs.target }} finished.\nDeploy: $STATUS | Smoke: $SMOKE\nVersion: ${{ needs.prepare.outputs.image_tag }}" \ + -F "message=$MESSAGE" \ -F "priority=$PRIORITY" || true