fix(ci): trigger release workflow from auto-tag pushes

Switch auto-tag to create and push tags via git instead of the tag API so Gitea emits a real tag push event that reliably starts release builds. Document the trigger behavior and add a workflow regression test.

Made-with: Cursor
This commit is contained in:
Shaun Arman 2026-04-04 21:14:41 -05:00
parent 42120cb140
commit 48041acc8c
3 changed files with 38 additions and 7 deletions

View File

@ -18,7 +18,8 @@ jobs:
env:
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
run: |
apk add --no-cache curl jq
set -eu
apk add --no-cache curl jq git
API="http://172.0.0.29:3000/api/v1/repos/$GITHUB_REPOSITORY"
@ -39,10 +40,20 @@ jobs:
echo "Latest tag: ${LATEST:-none} → Next: $NEXT"
# Create the new tag pointing at the commit that triggered this push
curl -sf -X POST "$API/tags" \
-H "Authorization: token $RELEASE_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"$NEXT\",\"message\":\"Release $NEXT\",\"target\":\"$GITHUB_SHA\"}"
# Create and push the tag via git so the tag push event triggers release.yml.
git init
git remote add origin "http://oauth2:${RELEASE_TOKEN}@172.0.0.29:3000/${GITHUB_REPOSITORY}.git"
git fetch --depth=1 origin "$GITHUB_SHA"
git checkout FETCH_HEAD
git config user.name "gitea-actions[bot]"
git config user.email "gitea-actions@local"
echo "Tag $NEXT created successfully"
if git ls-remote --exit-code --tags origin "refs/tags/$NEXT" >/dev/null 2>&1; then
echo "Tag $NEXT already exists; skipping."
exit 0
fi
git tag -a "$NEXT" -m "Release $NEXT"
git push origin "refs/tags/$NEXT"
echo "Tag $NEXT pushed successfully"

View File

@ -69,6 +69,9 @@ steps:
**Triggers:** Git tags matching `v*`
Auto tags are created by `.gitea/workflows/auto-tag.yml` using `git tag` + `git push`
(not the tag API endpoint), so the tag push event reliably triggers this workflow.
```
Jobs (run in parallel):
build-linux-amd64 → cargo tauri build (x86_64-unknown-linux-gnu)

View File

@ -0,0 +1,17 @@
import { describe, expect, it } from "vitest";
import { readFileSync } from "node:fs";
import path from "node:path";
const autoTagWorkflowPath = path.resolve(
process.cwd(),
".gitea/workflows/auto-tag.yml",
);
describe("auto-tag workflow release triggering", () => {
it("creates tags via git push instead of Gitea tag API", () => {
const workflow = readFileSync(autoTagWorkflowPath, "utf-8");
expect(workflow).toContain("git push origin \"refs/tags/$NEXT\"");
expect(workflow).not.toContain("POST \"$API/tags\"");
});
});