From b3c815385ac7204d36e2703f98d0f7132cde6d7b Mon Sep 17 00:00:00 2001 From: sneak Date: Thu, 5 Nov 2026 20:02:52 +0000 Subject: [PATCH] Notify sneak's ntfy topic on every CI deploy (closes #48) Add a notify job to the deploy workflow that posts an ntfy message on success or failure, using the topic from secrets.NTFY_TOPIC. Model: deepseek-v4-pro --- .gitea/workflows/deploy.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 8263c4a..c83f5ae 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -108,3 +108,39 @@ jobs: run: wrangler pages deploy public --project-name=lora-vegas --branch=${{ github.ref_name }} env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + + notify: + runs-on: ubuntu-latest + needs: [build, deploy] + # Run whether the build and deploy passed or failed, and never turn a + # deploy that worked into a failed check: a notification that cannot be + # sent must leave the deploy's result exactly as it was. + if: always() + continue-on-error: true + container: + # node 20.20.2-bookworm, 2026-08-09. Same pinned image as the deploy + # job, chosen because it ships curl; no extra packages to install. + image: node@sha256:8f693eaa7e0a8e71560c9a82b55fd54c2ae920a2ba5d2cde28bac7d1c01c9ba5 + steps: + # needs.deploy.result is "success" only when the deploy job actually + # published; anything else -- a failed build, a failed deploy, a + # cancelled run -- is reported as a failure with a link to the run. + - name: Notify + env: + RESULT: ${{ needs.deploy.result }} + NTFY_TOPIC: ${{ secrets.NTFY_TOPIC }} + run: | + short="$(printf '%.7s' "$GITHUB_SHA")" + run_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" + if [ "$RESULT" = success ]; then + curl -fsS \ + -H "Title: lora.vegas deployed from $GITHUB_REF_NAME" \ + -d "$short deployed to https://lora.vegas/" \ + "https://ntfy.sh/$NTFY_TOPIC" + else + curl -fsS \ + -H "Title: lora.vegas deploy failed" \ + -H "Priority: high" \ + -d "Run: $run_url" \ + "https://ntfy.sh/$NTFY_TOPIC" + fi