Replaces the per-project deploy scripts and self-contained webhook receivers with one manifest-driven implementation that lives outside the application repositories and can be updated independently of them. First targets: domaindingo test and prod on s5.
2.0 KiB
2.0 KiB
ntfy CI Notification Setup
Send an ntfy message on workflow success and another on failure, for push
events only. Needs curl in the runner and the ntfy server reachable from CI.
- Base URL via workflow env:
NTFY_BASE_URL: https://ntfy.fisher.hu - Topic = repo name with
/→-:topic="${GITHUB_REPOSITORY//\//-}"(e.g.webdev/domaindingo→webdev-domaindingo)
env:
NTFY_BASE_URL: https://ntfy.fisher.hu
jobs:
notify_ok:
runs-on: ubuntu-latest
needs: [build, publish_project_status] # replace with your pipeline jobs
if: ${{ always() && github.event_name == 'push' && needs.build.result == 'success' && needs.publish_project_status.result == 'success' }}
steps:
- name: Notify ntfy (success)
env: { COMMIT_MESSAGE: "${{ github.event.head_commit.message }}" }
run: |
topic="${GITHUB_REPOSITORY//\//-}"
curl -fsS -d "✅ Repo: ${GITHUB_REPOSITORY} | Branch: ${GITHUB_REF_NAME} | Message: ${COMMIT_MESSAGE}" \
"${NTFY_BASE_URL}/${topic}"
notify_failure:
runs-on: ubuntu-latest
needs: [build, publish_project_status]
if: ${{ always() && github.event_name == 'push' && (needs.build.result != 'success' || needs.publish_project_status.result != 'success') }}
steps:
- name: Notify ntfy (failure)
env: { COMMIT_MESSAGE: "${{ github.event.head_commit.message }}" }
run: |
topic="${GITHUB_REPOSITORY//\//-}"
curl -fsS -d "❌ Repo: ${GITHUB_REPOSITORY} | Branch: ${GITHUB_REF_NAME} | Message: ${COMMIT_MESSAGE}" \
"${NTFY_BASE_URL}/${topic}"
Notes
needs:must list the jobs that define "done"; theif:expressions decide success vs. failure. Keepalways()so the failure job still runs when an upstream job fails.- Limit to
push:github.event.head_commit.messageis absent on other events. curl -fsSfails the step on HTTP errors while still printing diagnostics.- Auth: if the server needs a token, store it as a secret and add
-H "Authorization: Bearer ${NTFY_TOKEN}"to the curl call.