From 9468d01a88239998c47349f72c1daa4e93020ec3 Mon Sep 17 00:00:00 2001 From: Developer Date: Mon, 6 Apr 2026 17:50:11 -0700 Subject: [PATCH] Coordinators now dispatch per-OS builds via API Previously per-OS build workflows triggered on tag push events, but Gitea doesn't fire events for tags pushed by other workflows. Now: - release.yml dispatches build-app-{linux,windows,macos}.yml via the Gitea API after creating the tag and release - sidecar-release.yml dispatches build-sidecar-{linux,windows,macos}.yml Per-OS workflows changed from push+dispatch triggers to dispatch-only with tag as a required input. To re-run a failed build for the same version, just dispatch the specific OS workflow with the same tag -- upload logic replaces existing assets automatically. Co-Authored-By: Claude Opus 4.6 (1M context) --- .gitea/workflows/build-app-linux.yml | 12 +++------- .gitea/workflows/build-app-macos.yml | 12 +++------- .gitea/workflows/build-app-windows.yml | 21 +++++------------ .gitea/workflows/build-sidecar-linux.yml | 14 ++++-------- .gitea/workflows/build-sidecar-macos.yml | 14 ++++-------- .gitea/workflows/build-sidecar-windows.yml | 23 +++++-------------- .gitea/workflows/release.yml | 26 ++++++++++++++-------- .gitea/workflows/sidecar-release.yml | 25 +++++++++++++++------ 8 files changed, 60 insertions(+), 87 deletions(-) diff --git a/.gitea/workflows/build-app-linux.yml b/.gitea/workflows/build-app-linux.yml index 97d6e1a..1964818 100644 --- a/.gitea/workflows/build-app-linux.yml +++ b/.gitea/workflows/build-app-linux.yml @@ -1,14 +1,11 @@ name: Build App (Linux) on: - push: - tags: - - 'v*' workflow_dispatch: inputs: tag: description: 'Release tag to build (e.g. v1.4.5)' - required: false + required: true jobs: build-linux: @@ -20,11 +17,8 @@ jobs: - name: Determine tag id: tag run: | - if [ -n "${{ github.event.inputs.tag }}" ]; then - TAG="${{ github.event.inputs.tag }}" - elif [[ "${{ github.ref }}" == refs/tags/* ]]; then - TAG="${{ github.ref_name }}" - else + TAG="${{ github.event.inputs.tag }}" + if [ -z "$TAG" ]; then TAG=$(git ls-remote --tags --sort=-v:refname origin 'refs/tags/v*' | head -1 | sed 's|.*refs/tags/||') fi echo "Building for tag: ${TAG}" diff --git a/.gitea/workflows/build-app-macos.yml b/.gitea/workflows/build-app-macos.yml index b43a662..5a34a57 100644 --- a/.gitea/workflows/build-app-macos.yml +++ b/.gitea/workflows/build-app-macos.yml @@ -1,14 +1,11 @@ name: Build App (macOS) on: - push: - tags: - - 'v*' workflow_dispatch: inputs: tag: description: 'Release tag to build (e.g. v1.4.5)' - required: false + required: true jobs: build-macos: @@ -20,11 +17,8 @@ jobs: - name: Determine tag id: tag run: | - if [ -n "${{ github.event.inputs.tag }}" ]; then - TAG="${{ github.event.inputs.tag }}" - elif [[ "${{ github.ref }}" == refs/tags/* ]]; then - TAG="${{ github.ref_name }}" - else + TAG="${{ github.event.inputs.tag }}" + if [ -z "$TAG" ]; then TAG=$(git ls-remote --tags --sort=-v:refname origin 'refs/tags/v*' | head -1 | sed 's|.*refs/tags/||') fi echo "Building for tag: ${TAG}" diff --git a/.gitea/workflows/build-app-windows.yml b/.gitea/workflows/build-app-windows.yml index cbcf323..46897ab 100644 --- a/.gitea/workflows/build-app-windows.yml +++ b/.gitea/workflows/build-app-windows.yml @@ -1,14 +1,11 @@ name: Build App (Windows) on: - push: - tags: - - 'v*' workflow_dispatch: inputs: tag: description: 'Release tag to build (e.g. v1.4.5)' - required: false + required: true jobs: build-windows: @@ -21,20 +18,12 @@ jobs: id: tag shell: powershell run: | - $inputTag = "${{ github.event.inputs.tag }}" - $ref = "${{ github.ref }}" - $refName = "${{ github.ref_name }}" - - if ($inputTag) { - $TAG = $inputTag - } elseif ($ref -like "refs/tags/*") { - $TAG = $refName - } else { - $tags = git ls-remote --tags --sort=-v:refname origin 'refs/tags/v*' 2>&1 - $TAG = ($tags | Select-Object -First 1) -replace '.*refs/tags/', '' + $TAG = "${{ github.event.inputs.tag }}" + if (-not $TAG) { + $TAG = (git ls-remote --tags --sort=-v:refname origin 'refs/tags/v*' | Select-Object -First 1) -replace '.*refs/tags/', '' } Write-Host "Building for tag: ${TAG}" - echo "tag=${TAG}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append + echo "tag=${TAG}" >> $env:GITHUB_OUTPUT - uses: actions/checkout@v4 with: diff --git a/.gitea/workflows/build-sidecar-linux.yml b/.gitea/workflows/build-sidecar-linux.yml index e502896..33d4ba7 100644 --- a/.gitea/workflows/build-sidecar-linux.yml +++ b/.gitea/workflows/build-sidecar-linux.yml @@ -1,14 +1,11 @@ name: Build Sidecar (Linux) on: - push: - tags: - - 'sidecar-v*' workflow_dispatch: inputs: tag: - description: 'Release tag to build (e.g. sidecar-v1.0.3)' - required: false + description: 'Sidecar release tag to build (e.g. sidecar-v1.0.3)' + required: true jobs: build-sidecar-linux: @@ -20,11 +17,8 @@ jobs: - name: Determine tag id: tag run: | - if [ -n "${{ github.event.inputs.tag }}" ]; then - TAG="${{ github.event.inputs.tag }}" - elif [[ "${{ github.ref }}" == refs/tags/* ]]; then - TAG="${{ github.ref_name }}" - else + TAG="${{ github.event.inputs.tag }}" + if [ -z "$TAG" ]; then TAG=$(git ls-remote --tags --sort=-v:refname origin 'refs/tags/sidecar-v*' | head -1 | sed 's|.*refs/tags/||') fi echo "Building for tag: ${TAG}" diff --git a/.gitea/workflows/build-sidecar-macos.yml b/.gitea/workflows/build-sidecar-macos.yml index 2ea624e..5398ccb 100644 --- a/.gitea/workflows/build-sidecar-macos.yml +++ b/.gitea/workflows/build-sidecar-macos.yml @@ -1,14 +1,11 @@ name: Build Sidecar (macOS) on: - push: - tags: - - 'sidecar-v*' workflow_dispatch: inputs: tag: - description: 'Release tag to build (e.g. sidecar-v1.0.3)' - required: false + description: 'Sidecar release tag to build (e.g. sidecar-v1.0.3)' + required: true jobs: build-sidecar-macos: @@ -20,11 +17,8 @@ jobs: - name: Determine tag id: tag run: | - if [ -n "${{ github.event.inputs.tag }}" ]; then - TAG="${{ github.event.inputs.tag }}" - elif [[ "${{ github.ref }}" == refs/tags/* ]]; then - TAG="${{ github.ref_name }}" - else + TAG="${{ github.event.inputs.tag }}" + if [ -z "$TAG" ]; then TAG=$(git ls-remote --tags --sort=-v:refname origin 'refs/tags/sidecar-v*' | head -1 | sed 's|.*refs/tags/||') fi echo "Building for tag: ${TAG}" diff --git a/.gitea/workflows/build-sidecar-windows.yml b/.gitea/workflows/build-sidecar-windows.yml index 1062fb2..76545d2 100644 --- a/.gitea/workflows/build-sidecar-windows.yml +++ b/.gitea/workflows/build-sidecar-windows.yml @@ -1,14 +1,11 @@ name: Build Sidecar (Windows) on: - push: - tags: - - 'sidecar-v*' workflow_dispatch: inputs: tag: - description: 'Release tag to build (e.g. sidecar-v1.0.3)' - required: false + description: 'Sidecar release tag to build (e.g. sidecar-v1.0.3)' + required: true jobs: build-sidecar-windows: @@ -21,20 +18,12 @@ jobs: id: tag shell: powershell run: | - $inputTag = "${{ github.event.inputs.tag }}" - $ref = "${{ github.ref }}" - $refName = "${{ github.ref_name }}" - - if ($inputTag) { - $TAG = $inputTag - } elseif ($ref -like "refs/tags/*") { - $TAG = $refName - } else { - $tags = git ls-remote --tags --sort=-v:refname origin 'refs/tags/sidecar-v*' 2>&1 - $TAG = ($tags | Select-Object -First 1) -replace '.*refs/tags/', '' + $TAG = "${{ github.event.inputs.tag }}" + if (-not $TAG) { + $TAG = (git ls-remote --tags --sort=-v:refname origin 'refs/tags/sidecar-v*' | Select-Object -First 1) -replace '.*refs/tags/', '' } Write-Host "Building for tag: ${TAG}" - echo "tag=${TAG}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append + echo "tag=${TAG}" >> $env:GITHUB_OUTPUT - uses: actions/checkout@v4 with: diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 0d7a402..3c2e10a 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -25,11 +25,9 @@ jobs: - name: Bump patch version id: bump run: | - # Read current version from package.json CURRENT=$(grep '"version"' package.json | head -1 | sed 's/.*"version": *"\([^"]*\)".*/\1/') echo "Current version: ${CURRENT}" - # Increment patch number MAJOR=$(echo "${CURRENT}" | cut -d. -f1) MINOR=$(echo "${CURRENT}" | cut -d. -f2) PATCH=$(echo "${CURRENT}" | cut -d. -f3) @@ -37,16 +35,9 @@ jobs: NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}" echo "New version: ${NEW_VERSION}" - # Update package.json sed -i "s/\"version\": \"${CURRENT}\"/\"version\": \"${NEW_VERSION}\"/" package.json - - # Update src-tauri/tauri.conf.json sed -i "s/\"version\": \"${CURRENT}\"/\"version\": \"${NEW_VERSION}\"/" src-tauri/tauri.conf.json - - # Update src-tauri/Cargo.toml sed -i "s/^version = \"${CURRENT}\"/version = \"${NEW_VERSION}\"/" src-tauri/Cargo.toml - - # Update version.py sed -i "s/__version__ = \"${CURRENT}\"/__version__ = \"${NEW_VERSION}\"/" version.py sed -i "s/__version_info__ = .*/__version_info__ = (${MAJOR}, ${MINOR}, ${NEW_PATCH})/" version.py @@ -81,3 +72,20 @@ jobs: -d "{\"tag_name\": \"${TAG}\", \"name\": \"${RELEASE_NAME}\", \"body\": \"Automated build.\", \"draft\": false, \"prerelease\": false}" \ "${REPO_API}/releases" echo "Created release: ${RELEASE_NAME}" + + - name: Trigger per-OS app builds + env: + BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }} + run: | + REPO_API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}" + TAG="${{ steps.bump.outputs.tag }}" + + for workflow in build-app-linux.yml build-app-windows.yml build-app-macos.yml; do + echo "Dispatching ${workflow} for ${TAG}..." + HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -X POST \ + -H "Authorization: token ${BUILD_TOKEN}" \ + -H "Content-Type: application/json" \ + -d "{\"ref\": \"main\", \"inputs\": {\"tag\": \"${TAG}\"}}" \ + "${REPO_API}/actions/workflows/${workflow}/dispatches") + echo " -> HTTP ${HTTP_CODE}" + done diff --git a/.gitea/workflows/sidecar-release.yml b/.gitea/workflows/sidecar-release.yml index b4c846f..0fc1e11 100644 --- a/.gitea/workflows/sidecar-release.yml +++ b/.gitea/workflows/sidecar-release.yml @@ -28,12 +28,10 @@ jobs: - name: Check for backend changes id: check_changes run: | - # If triggered by workflow_dispatch, always build if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then echo "has_changes=true" >> $GITHUB_OUTPUT exit 0 fi - # Check if relevant files changed in this commit CHANGED=$(git diff --name-only HEAD~1 HEAD -- client/ server/ backend/ pyproject.toml local-transcription-headless.spec 2>/dev/null || echo "") if [ -n "$CHANGED" ]; then echo "has_changes=true" >> $GITHUB_OUTPUT @@ -53,11 +51,9 @@ jobs: if: steps.check_changes.outputs.has_changes == 'true' id: bump run: | - # Read current version from pyproject.toml CURRENT=$(grep '^version = ' pyproject.toml | head -1 | sed 's/version = "\(.*\)"/\1/') echo "Current sidecar version: ${CURRENT}" - # Increment patch number MAJOR=$(echo "${CURRENT}" | cut -d. -f1) MINOR=$(echo "${CURRENT}" | cut -d. -f2) PATCH=$(echo "${CURRENT}" | cut -d. -f3) @@ -65,10 +61,7 @@ jobs: NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}" echo "New sidecar version: ${NEW_VERSION}" - # Update pyproject.toml sed -i "s/^version = \"${CURRENT}\"/version = \"${NEW_VERSION}\"/" pyproject.toml - - # Update version.py sed -i "s/__version__ = \"${CURRENT}\"/__version__ = \"${NEW_VERSION}\"/" version.py sed -i "s/__version_info__ = .*/__version_info__ = (${MAJOR}, ${MINOR}, ${NEW_PATCH})/" version.py @@ -107,3 +100,21 @@ jobs: -d "{\"tag_name\": \"${TAG}\", \"name\": \"${RELEASE_NAME}\", \"body\": \"Automated sidecar build.\", \"draft\": false, \"prerelease\": false}" \ "${REPO_API}/releases" echo "Created release: ${RELEASE_NAME}" + + - name: Trigger per-OS sidecar builds + if: steps.check_changes.outputs.has_changes == 'true' + env: + BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }} + run: | + REPO_API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}" + TAG="${{ steps.bump.outputs.tag }}" + + for workflow in build-sidecar-linux.yml build-sidecar-windows.yml build-sidecar-macos.yml; do + echo "Dispatching ${workflow} for ${TAG}..." + HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -X POST \ + -H "Authorization: token ${BUILD_TOKEN}" \ + -H "Content-Type: application/json" \ + -d "{\"ref\": \"main\", \"inputs\": {\"tag\": \"${TAG}\"}}" \ + "${REPO_API}/actions/workflows/${workflow}/dispatches") + echo " -> HTTP ${HTTP_CODE}" + done