From b7a00af2e097b1979e9405e4401551c8a64d862d Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Mar 2026 11:30:57 -0700 Subject: [PATCH] Fix duplicate CI runs: remove tags trigger, detect tags on commit Pushing to main + a tag triggered 6 workflows (3 per trigger). Now only main pushes trigger builds. The upload step detects version tags on the current commit via git tag --points-at HEAD. Co-Authored-By: Claude Opus 4.6 --- .gitea/workflows/build-linux.yml | 10 +++++----- .gitea/workflows/build-macos.yml | 10 +++++----- .gitea/workflows/build-windows.yml | 11 +++++------ 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/.gitea/workflows/build-linux.yml b/.gitea/workflows/build-linux.yml index f628761..ba3c224 100644 --- a/.gitea/workflows/build-linux.yml +++ b/.gitea/workflows/build-linux.yml @@ -3,7 +3,6 @@ name: Build Linux on: push: branches: [main] - tags: ["v*"] pull_request: branches: [main] @@ -66,16 +65,17 @@ jobs: # ── Release ── - name: Upload to release - if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') + if: github.ref == 'refs/heads/main' env: BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }} run: | sudo apt-get install -y jq REPO_API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}" - # Use version tag for tag pushes, "latest" for main - if [[ "${GITHUB_REF}" == refs/tags/* ]]; then - TAG="${GITHUB_REF#refs/tags/}" + # Check if the current commit has a version tag + VERSION_TAG=$(git tag --points-at HEAD | grep '^v' | head -1) + if [ -n "${VERSION_TAG}" ]; then + TAG="${VERSION_TAG}" RELEASE_NAME="Voice to Notes ${TAG}" PRERELEASE=false else diff --git a/.gitea/workflows/build-macos.yml b/.gitea/workflows/build-macos.yml index 1324d69..971b45a 100644 --- a/.gitea/workflows/build-macos.yml +++ b/.gitea/workflows/build-macos.yml @@ -3,7 +3,6 @@ name: Build macOS on: push: branches: [main] - tags: ["v*"] pull_request: branches: [main] @@ -65,15 +64,16 @@ jobs: # ── Release ── - name: Upload to release - if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') + if: github.ref == 'refs/heads/main' env: BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }} run: | REPO_API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}" - # Use version tag for tag pushes, "latest" for main - if [[ "${GITHUB_REF}" == refs/tags/* ]]; then - TAG="${GITHUB_REF#refs/tags/}" + # Check if the current commit has a version tag + VERSION_TAG=$(git tag --points-at HEAD | grep '^v' | head -1) + if [ -n "${VERSION_TAG}" ]; then + TAG="${VERSION_TAG}" RELEASE_NAME="Voice to Notes ${TAG}" PRERELEASE=false else diff --git a/.gitea/workflows/build-windows.yml b/.gitea/workflows/build-windows.yml index 1715a2d..9d1d537 100644 --- a/.gitea/workflows/build-windows.yml +++ b/.gitea/workflows/build-windows.yml @@ -3,7 +3,6 @@ name: Build Windows on: push: branches: [main] - tags: ["v*"] pull_request: branches: [main] @@ -75,7 +74,7 @@ jobs: # ── Release ── - name: Upload to release - if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') + if: github.ref == 'refs/heads/main' shell: powershell env: BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }} @@ -83,10 +82,10 @@ jobs: $REPO_API = "${{ github.server_url }}/api/v1/repos/${{ github.repository }}" $Headers = @{ "Authorization" = "token $env:BUILD_TOKEN" } - # Use version tag for tag pushes, "latest" for main - $REF = "${{ github.ref }}" - if ($REF.StartsWith("refs/tags/")) { - $TAG = $REF.Replace("refs/tags/", "") + # Check if the current commit has a version tag + $VERSION_TAG = (git tag --points-at HEAD | Select-String '^v').Line + if ($VERSION_TAG) { + $TAG = $VERSION_TAG $RELEASE_NAME = "Voice to Notes ${TAG}" $PRERELEASE = $false } else {