From 72fd363600e6966203298a801608f76a5d4726f1 Mon Sep 17 00:00:00 2001 From: "tao.chen" <93983997+taochen-ct@users.noreply.github.com> Date: Tue, 21 Jul 2026 18:51:57 +0800 Subject: [PATCH] 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 --- {scripts => .github/scripts}/bark-notify.sh | 0 .github/workflows/build.yml | 51 ++++++++++++++++++++- 2 files changed, 50 insertions(+), 1 deletion(-) rename {scripts => .github/scripts}/bark-notify.sh (100%) diff --git a/scripts/bark-notify.sh b/.github/scripts/bark-notify.sh similarity index 100% rename from scripts/bark-notify.sh rename to .github/scripts/bark-notify.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fbd507f..9383e50 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,6 +31,55 @@ jobs: path: dist/snapshot-* if-no-files-found: error + # Only create a release + attach dist/ assets when pushing a v* tag. + # On branch pushes / pull requests this step is skipped entirely. + - name: Upload release assets via Gitea API + if: startsWith(github.ref, 'refs/tags/v') + env: + GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + TAG_NAME="${{ github.ref_name }}" + + echo "Creating Gitea release for tag ${TAG_NAME}..." + + RELEASE_RESPONSE=$(curl -fsS -X POST "${{ github.api_url }}/repos/${{ github.repository }}/releases" \ + -H "accept: application/json" \ + -H "authorization: token ${GITEA_TOKEN}" \ + -H "Content-Type: application/json" \ + -d "$(cat <