Compare commits

..
1 Commits
Author SHA1 Message Date
sneak b3c815385a Notify sneak's ntfy topic on every CI deploy (closes #48)
check / check (push) Successful in 2m55s
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
2026-11-05 20:02:52 +00:00
2 changed files with 9 additions and 23 deletions
+9 -13
View File
@@ -112,24 +112,20 @@ jobs:
notify: notify:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [build, deploy] needs: [build, deploy]
# Run whether the build and deploy passed or failed. The Notify step # Run whether the build and deploy passed or failed, and never turn a
# carries continue-on-error: true so a notification that cannot be sent # deploy that worked into a failed check: a notification that cannot be
# leaves the deploy's result exactly as it was. # sent must leave the deploy's result exactly as it was.
if: always() if: always()
continue-on-error: true
container: container:
# node 20.20.2-bookworm, 2026-08-09. Same pinned image as the deploy # 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. # job, chosen because it ships curl; no extra packages to install.
image: node@sha256:8f693eaa7e0a8e71560c9a82b55fd54c2ae920a2ba5d2cde28bac7d1c01c9ba5 image: node@sha256:8f693eaa7e0a8e71560c9a82b55fd54c2ae920a2ba5d2cde28bac7d1c01c9ba5
steps: steps:
# needs.deploy.result is "success" only when the deploy job actually # needs.deploy.result is "success" only when the deploy job actually
# published; anything else -- a failed build or a failed deploy -- is # published; anything else -- a failed build, a failed deploy, a
# reported as a failure with a link to the run. # cancelled run -- is reported as a failure with a link to the run.
- name: Notify - name: Notify
# curl failing (ntfy unreachable or erroring, or NTFY_TOPIC
# absent) must not fail the run, so continue-on-error lives on
# this step and not on the job: on this Gitea a job-level flag
# still marks the job failed and reddens the commit.
continue-on-error: true
env: env:
RESULT: ${{ needs.deploy.result }} RESULT: ${{ needs.deploy.result }}
NTFY_TOPIC: ${{ secrets.NTFY_TOPIC }} NTFY_TOPIC: ${{ secrets.NTFY_TOPIC }}
@@ -137,13 +133,13 @@ jobs:
short="$(printf '%.7s' "$GITHUB_SHA")" short="$(printf '%.7s' "$GITHUB_SHA")"
run_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" run_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
if [ "$RESULT" = success ]; then if [ "$RESULT" = success ]; then
curl -fsS --max-time 10 \ curl -fsS \
-H "Title: lora.vegas deployed from $GITHUB_REF_NAME" \ -H "Title: lora.vegas deployed from $GITHUB_REF_NAME" \
-d "$short deployed to https://lora.vegas/" \ -d "$short deployed to https://lora.vegas/" \
"https://ntfy.sh/$NTFY_TOPIC" "https://ntfy.sh/$NTFY_TOPIC"
else else
curl -fsS --max-time 10 \ curl -fsS \
-H "Title: lora.vegas deploy from $GITHUB_REF_NAME failed" \ -H "Title: lora.vegas deploy failed" \
-H "Priority: high" \ -H "Priority: high" \
-d "Run: $run_url" \ -d "Run: $run_url" \
"https://ntfy.sh/$NTFY_TOPIC" "https://ntfy.sh/$NTFY_TOPIC"
-10
View File
@@ -34,16 +34,6 @@ leaning on `.gitignore` (https://git.eeqj.de/sneak/lora.vegas/issues/33).
# Completed Steps # Completed Steps
- 2026-11-05: added a `notify` job to the deploy workflow that posts an ntfy
message on every deploy, success or failure (closes
https://git.eeqj.de/sneak/lora.vegas/issues/48). The job runs `if: always()`
so it fires whether the build and deploy passed or failed, and the Notify step
carries `continue-on-error: true` so a notification that cannot be sent leaves
the deploy's result exactly as it was. On success the message body is the
short commit plus the site URL, and on failure it is a link to the run. The
topic comes from the `NTFY_TOPIC` Actions secret, which sneak must add before
anything is sent; the topic is never written in the repository. Both curl
calls carry `--max-time 10` so a stalled ntfy cannot hold the run open
- 2026-10-21: made `script/lint` fail when two pages write the same output path - 2026-10-21: made `script/lint` fail when two pages write the same output path
(https://git.eeqj.de/sneak/lora.vegas/issues/25). `Dockerfile.lint` now runs (https://git.eeqj.de/sneak/lora.vegas/issues/25). `Dockerfile.lint` now runs
`hugo --minify --printPathWarnings --panicOnWarning`. `--printPathWarnings` `hugo --minify --printPathWarnings --panicOnWarning`. `--printPathWarnings`