From f278b66efbe13aff8d4ab9ec516be2c9515f6e85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Untersch=C3=BCtz?= Date: Mon, 23 Nov 2026 19:22:55 +0100 Subject: [PATCH] ci: release only tags on main Only code that reached main through a protected merge is released, the release workflow included: a tag on any other commit, such as one with a changed workflow, publishes nothing. Together with the tag protection that leaves v* tags to the Owners team. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3 --- .gitea/workflows/release.yaml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index eee8ca1..d7b8d23 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -1,7 +1,8 @@ name: release -# Runs for release tags, which `make release` creates. The image of a tag -# is built by the ci workflow. +# Runs for release tags, which `make release` creates. Only the Owners team +# may push v* tags (tag protection), and only tags on main are released. +# The image of a tag is built by the ci workflow. on: push: tags: ["v*"] @@ -20,7 +21,16 @@ jobs: curl -fsSL "https://go.dev/dl/go${v}.linux-amd64.tar.gz" | tar -C /usr/local -xz echo /usr/local/go/bin >> "$GITHUB_PATH" - name: Check tag - run: go run ./tools/release check "$GITHUB_REF_NAME" + run: | + go run ./tools/release check "$GITHUB_REF_NAME" + # Only code that reached main through a protected merge is + # released, this workflow included: a tag on any other commit, + # e.g. one with a changed workflow, publishes nothing. + git fetch -q origin main + if ! git merge-base --is-ancestor "$GITHUB_SHA" origin/main; then + echo "::error::$GITHUB_REF_NAME does not point to a commit on main; not releasing." + exit 1 + fi - name: Build frontend run: npm ci --no-audit --no-fund && npm run build - name: Build binaries -- 2.54.1