Merge sidecar and app builds into single jobs per platform
Removes the artifact upload/download overhead between sidecar and app build steps. Each platform now runs as a single job: build sidecar, copy it into src-tauri/binaries, build Tauri app, upload to release. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -13,12 +13,13 @@ env:
|
||||
TARGET: x86_64-unknown-linux-gnu
|
||||
|
||||
jobs:
|
||||
build-sidecar:
|
||||
name: Build sidecar (Linux)
|
||||
build:
|
||||
name: Build (Linux)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# ── Python sidecar ──
|
||||
- name: Install uv
|
||||
run: |
|
||||
if command -v uv &> /dev/null; then
|
||||
@@ -38,20 +39,13 @@ jobs:
|
||||
working-directory: python
|
||||
run: uv run --python ${{ env.PYTHON_VERSION }} python build_sidecar.py --cpu-only
|
||||
|
||||
- name: Upload sidecar artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: sidecar-linux
|
||||
path: python/dist/voice-to-notes-sidecar/
|
||||
retention-days: 7
|
||||
|
||||
build-app:
|
||||
name: Build app (Linux)
|
||||
needs: build-sidecar
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Place sidecar for Tauri
|
||||
run: |
|
||||
mkdir -p src-tauri/binaries
|
||||
cp -r python/dist/voice-to-notes-sidecar/* src-tauri/binaries/
|
||||
chmod +x src-tauri/binaries/voice-to-notes-sidecar-${{ env.TARGET }}
|
||||
|
||||
# ── Tauri app ──
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
@@ -64,18 +58,8 @@ jobs:
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf xdg-utils
|
||||
|
||||
- name: Download sidecar artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: sidecar-linux
|
||||
path: src-tauri/binaries/
|
||||
|
||||
- name: Make sidecar executable
|
||||
run: chmod +x src-tauri/binaries/voice-to-notes-sidecar-${{ env.TARGET }}
|
||||
|
||||
- name: Install npm dependencies
|
||||
run: npm ci
|
||||
|
||||
@@ -84,43 +68,20 @@ jobs:
|
||||
env:
|
||||
TAURI_CONFIG: '{"bundle":{"externalBin":["binaries/voice-to-notes-sidecar"]}}'
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: app-linux
|
||||
path: |
|
||||
src-tauri/target/release/bundle/deb/*.deb
|
||||
src-tauri/target/release/bundle/appimage/*.AppImage
|
||||
retention-days: 30
|
||||
|
||||
release:
|
||||
name: Release (Linux)
|
||||
needs: build-app
|
||||
if: github.ref == 'refs/heads/main'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install tools
|
||||
run: sudo apt-get update && sudo apt-get install -y jq curl
|
||||
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: app-linux
|
||||
path: artifacts/
|
||||
|
||||
- name: Create or update release
|
||||
# ── Release ──
|
||||
- name: Upload to release
|
||||
if: github.ref == 'refs/heads/main'
|
||||
env:
|
||||
BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
|
||||
run: |
|
||||
sudo apt-get install -y jq
|
||||
TAG="latest"
|
||||
REPO_API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
|
||||
|
||||
# Check if release exists
|
||||
RELEASE_ID=$(curl -s -H "Authorization: token ${BUILD_TOKEN}" \
|
||||
"${REPO_API}/releases/tags/${TAG}" | jq -r '.id // empty')
|
||||
|
||||
if [ -z "${RELEASE_ID}" ]; then
|
||||
# Create new release
|
||||
RELEASE_ID=$(curl -s -X POST \
|
||||
-H "Authorization: token ${BUILD_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
@@ -134,14 +95,11 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Upload artifacts (delete existing ones with same name first)
|
||||
find artifacts/ -type f \( -name "*.deb" -o -name "*.AppImage" \) | while IFS= read -r file; do
|
||||
find src-tauri/target/release/bundle -type f \( -name "*.deb" -o -name "*.AppImage" \) | while IFS= read -r file; do
|
||||
filename=$(basename "$file")
|
||||
# URL-encode spaces in filename for the API
|
||||
encoded_name=$(echo "$filename" | sed 's/ /%20/g')
|
||||
echo "Uploading ${filename} ($(du -h "$file" | cut -f1))..."
|
||||
|
||||
# Delete existing asset with same name
|
||||
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
|
||||
@@ -149,14 +107,10 @@ jobs:
|
||||
"${REPO_API}/releases/${RELEASE_ID}/assets/${ASSET_ID}"
|
||||
fi
|
||||
|
||||
# Upload using -T for streaming (avoids loading entire file into memory)
|
||||
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}"
|
||||
if [ "$HTTP_CODE" -ge 400 ]; then
|
||||
echo "WARNING: Upload failed for ${filename}"
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user