Two issues causing all builds to fail: 1. Cleanup steps deleted git tags along with releases. Since builds are dispatched asynchronously, they tried to checkout tags that had already been deleted. Now cleanup only deletes releases (which frees storage by removing assets) but preserves git tags. 2. Linux/macOS build workflows used $GITHUB_OUTPUT step outputs for the tag, which is unreliable on Gitea runners. Switched to the same job-level env var pattern (RELEASE_TAG) that works on Windows. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
101 lines
3.5 KiB
YAML
101 lines
3.5 KiB
YAML
name: Build Sidecar (macOS)
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: 'Sidecar release tag to build (e.g. sidecar-v1.0.3)'
|
|
required: true
|
|
|
|
jobs:
|
|
build-sidecar-macos:
|
|
name: Build Sidecar (macOS)
|
|
runs-on: macos-latest
|
|
env:
|
|
PYTHON_VERSION: "3.11"
|
|
RELEASE_TAG: ${{ inputs.tag }}
|
|
steps:
|
|
- name: Show tag
|
|
run: echo "Building for tag: ${RELEASE_TAG}"
|
|
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ inputs.tag }}
|
|
|
|
- name: Install uv
|
|
run: |
|
|
if command -v uv &> /dev/null; then
|
|
echo "uv already installed: $(uv --version)"
|
|
else
|
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
fi
|
|
|
|
- name: Set up Python
|
|
run: uv python install ${{ env.PYTHON_VERSION }}
|
|
|
|
- name: Install system dependencies
|
|
run: brew install portaudio
|
|
|
|
- name: Build sidecar (CPU)
|
|
env:
|
|
UV_NO_SOURCES: "1"
|
|
run: |
|
|
# UV_NO_SOURCES bypasses pyproject.toml's [tool.uv.sources] which forces
|
|
# torch from the CUDA index (no macOS ARM wheels there).
|
|
# Default PyPI torch includes MPS (Apple Silicon GPU) support.
|
|
uv sync
|
|
.venv/bin/pyinstaller local-transcription-headless.spec
|
|
|
|
- name: Package sidecar (CPU)
|
|
run: |
|
|
cd dist/local-transcription-backend && zip -r ../../sidecar-macos-aarch64-cpu.zip .
|
|
|
|
- name: Upload to sidecar release
|
|
env:
|
|
BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
|
|
run: |
|
|
which jq || brew install jq
|
|
REPO_API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
|
|
TAG="${RELEASE_TAG}"
|
|
|
|
echo "Waiting for sidecar release ${TAG} to be available..."
|
|
for i in $(seq 1 30); do
|
|
RELEASE_JSON=$(curl -s -H "Authorization: token ${BUILD_TOKEN}" \
|
|
"${REPO_API}/releases/tags/${TAG}")
|
|
RELEASE_ID=$(echo "$RELEASE_JSON" | jq -r '.id // empty')
|
|
|
|
if [ -n "${RELEASE_ID}" ] && [ "${RELEASE_ID}" != "null" ]; then
|
|
echo "Found sidecar release: ${TAG} (ID: ${RELEASE_ID})"
|
|
break
|
|
fi
|
|
|
|
echo "Attempt ${i}/30: Release not ready yet, retrying in 10s..."
|
|
sleep 10
|
|
done
|
|
|
|
if [ -z "${RELEASE_ID}" ] || [ "${RELEASE_ID}" = "null" ]; then
|
|
echo "ERROR: Failed to find sidecar release for tag ${TAG} after 30 attempts."
|
|
exit 1
|
|
fi
|
|
|
|
for file in sidecar-*.zip; do
|
|
filename=$(basename "$file")
|
|
encoded_name=$(echo "$filename" | sed 's/ /%20/g')
|
|
echo "Uploading ${filename} ($(du -h "$file" | cut -f1))..."
|
|
|
|
ASSET_ID=$(curl -s -H "Authorization: token ${BUILD_TOKEN}" \
|
|
"${REPO_API}/releases/${RELEASE_ID}/assets" | jq -r ".[] | select(.name == \"${filename}\") | .id // empty")
|
|
if [ -n "${ASSET_ID}" ]; then
|
|
curl -s -X DELETE -H "Authorization: token ${BUILD_TOKEN}" \
|
|
"${REPO_API}/releases/${RELEASE_ID}/assets/${ASSET_ID}"
|
|
fi
|
|
|
|
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
|
|
-H "Authorization: token ${BUILD_TOKEN}" \
|
|
-H "Content-Type: application/octet-stream" \
|
|
-T "$file" \
|
|
"${REPO_API}/releases/${RELEASE_ID}/assets?name=${encoded_name}")
|
|
echo "Upload response: HTTP ${HTTP_CODE}"
|
|
done
|