Files
tao.chenandClaude 72fd363600 ci: move bark-notify.sh to .github/scripts, add Gitea release asset upload
Two changes:

1. Move scripts/bark-notify.sh -> .github/scripts/bark-notify.sh
   (CI helper belongs next to the workflow that calls it). History
   preserved via git mv.

2. Add a 'Upload release assets via Gitea API' step that runs only
   on tag pushes (if: startsWith(github.ref, 'refs/tags/v')). It:
     - POSTs /releases to create a Gitea release bound to the tag
     - extracts the release id from the response (with explicit error
       path if the API call fails)
     - loops over dist/snapshot-*.whl and dist/snapshot-*.tar.gz and
       uploads each as a release asset
   Uses ${{ secrets.GITHUB_TOKEN }} exposed as the GITEA_TOKEN env
   var (the Gitea convention for the repo token secret). The
   Notify Bark step still runs last with if: always() so a release
   upload failure is reported via the phone.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-21 18:51:57 +08:00

38 lines
775 B
Bash
Executable File

#!/usr/bin/env bash
# bark-notify.sh — push a notification to the local Bark server.
#
# Usage: bark-notify.sh <title> <body>
#
# The Bark endpoint, device_key, and group are pinned in this script
# (it is a deployment detail, not a secret). The group is "Gitea" —
# change it here if you want to sort notifications by category.
set -euo pipefail
if [ "$#" -ne 2 ]; then
echo "usage: $0 <title> <body>" >&2
exit 1
fi
TITLE="$1"
BODY="$2"
PAYLOAD=$(cat <<EOF
{
"device_key": "6ZFVsxM95cuAjYoNLWSWaN",
"title": "${TITLE}",
"body": "${BODY}",
"group": "Gitea",
"isArchive": 1,
"ttl": 3600
}
EOF
)
curl -s \
-X POST http://101.43.40.124:81/push \
-H "Content-Type: application/json; charset=utf-8" \
-d "${PAYLOAD}"
echo "bark notified: ${TITLE}"