Find the generated .app bundle dynamically in release CI so macOS packaging no longer depends on the legacy TFTSR.app name. Add a unit test to prevent regressions by asserting the old hardcoded path is not reintroduced. Made-with: Cursor
227 lines
10 KiB
YAML
227 lines
10 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
build-linux-amd64:
|
|
runs-on: linux-amd64
|
|
container:
|
|
image: rust:1.88-slim
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
apt-get update -qq && apt-get install -y -qq git
|
|
git init
|
|
git remote add origin http://172.0.0.29:3000/sarman/tftsr-devops_investigation.git
|
|
git fetch --depth=1 origin $GITHUB_SHA
|
|
git checkout FETCH_HEAD
|
|
- name: Install dependencies
|
|
run: |
|
|
apt-get update -qq && apt-get install -y -qq \
|
|
libwebkit2gtk-4.1-dev libssl-dev libgtk-3-dev \
|
|
libayatana-appindicator3-dev librsvg2-dev patchelf \
|
|
pkg-config curl perl jq
|
|
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
|
apt-get install -y nodejs
|
|
- name: Build
|
|
run: |
|
|
npm ci --legacy-peer-deps
|
|
rustup target add x86_64-unknown-linux-gnu
|
|
cargo install tauri-cli --version "^2" --locked
|
|
CI=true cargo tauri build --target x86_64-unknown-linux-gnu
|
|
- name: Upload artifacts
|
|
env:
|
|
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
run: |
|
|
API="http://172.0.0.29:3000/api/v1/repos/$GITHUB_REPOSITORY"
|
|
TAG="$GITHUB_REF_NAME"
|
|
echo "Creating release for $TAG..."
|
|
curl -sf -X POST "$API/releases" \
|
|
-H "Authorization: token $RELEASE_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"tag_name\":\"$TAG\",\"name\":\"TFTSR $TAG\",\"body\":\"Release $TAG\",\"draft\":false}" || true
|
|
RELEASE_ID=$(curl -sf "$API/releases/tags/$TAG" \
|
|
-H "Authorization: token $RELEASE_TOKEN" | jq -r '.id')
|
|
if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "null" ]; then
|
|
echo "ERROR: Failed to get release ID for $TAG"
|
|
exit 1
|
|
fi
|
|
echo "Release ID: $RELEASE_ID"
|
|
find src-tauri/target/x86_64-unknown-linux-gnu/release/bundle \
|
|
\( -name "*.deb" -o -name "*.rpm" -o -name "*.AppImage" \) | while read f; do
|
|
echo "Uploading $(basename $f)..."
|
|
curl -sf -X POST "$API/releases/$RELEASE_ID/assets" \
|
|
-H "Authorization: token $RELEASE_TOKEN" \
|
|
-F "attachment=@$f;filename=$(basename $f)" && echo "✓ Uploaded $(basename $f)" || echo "✗ Upload failed: $f"
|
|
done
|
|
|
|
build-windows-amd64:
|
|
runs-on: linux-amd64
|
|
container:
|
|
image: rust:1.88-slim
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
apt-get update -qq && apt-get install -y -qq git
|
|
git init
|
|
git remote add origin http://172.0.0.29:3000/sarman/tftsr-devops_investigation.git
|
|
git fetch --depth=1 origin $GITHUB_SHA
|
|
git checkout FETCH_HEAD
|
|
- name: Install dependencies
|
|
run: |
|
|
apt-get update -qq && apt-get install -y -qq mingw-w64 curl nsis perl make jq
|
|
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
|
apt-get install -y nodejs
|
|
- name: Build
|
|
env:
|
|
CC_x86_64_pc_windows_gnu: x86_64-w64-mingw32-gcc
|
|
CXX_x86_64_pc_windows_gnu: x86_64-w64-mingw32-g++
|
|
AR_x86_64_pc_windows_gnu: x86_64-w64-mingw32-ar
|
|
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER: x86_64-w64-mingw32-gcc
|
|
run: |
|
|
npm ci --legacy-peer-deps
|
|
rustup target add x86_64-pc-windows-gnu
|
|
cargo install tauri-cli --version "^2" --locked
|
|
CI=true cargo tauri build --target x86_64-pc-windows-gnu
|
|
- name: Upload artifacts
|
|
env:
|
|
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
run: |
|
|
API="http://172.0.0.29:3000/api/v1/repos/$GITHUB_REPOSITORY"
|
|
TAG="$GITHUB_REF_NAME"
|
|
echo "Creating release for $TAG..."
|
|
curl -sf -X POST "$API/releases" \
|
|
-H "Authorization: token $RELEASE_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"tag_name\":\"$TAG\",\"name\":\"TFTSR $TAG\",\"body\":\"Release $TAG\",\"draft\":false}" || true
|
|
RELEASE_ID=$(curl -sf "$API/releases/tags/$TAG" \
|
|
-H "Authorization: token $RELEASE_TOKEN" | jq -r '.id')
|
|
if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "null" ]; then
|
|
echo "ERROR: Failed to get release ID for $TAG"
|
|
exit 1
|
|
fi
|
|
echo "Release ID: $RELEASE_ID"
|
|
find src-tauri/target/x86_64-pc-windows-gnu/release/bundle \
|
|
\( -name "*.exe" -o -name "*.msi" \) 2>/dev/null | while read f; do
|
|
echo "Uploading $(basename $f)..."
|
|
curl -sf -X POST "$API/releases/$RELEASE_ID/assets" \
|
|
-H "Authorization: token $RELEASE_TOKEN" \
|
|
-F "attachment=@$f;filename=$(basename $f)" && echo "✓ Uploaded $(basename $f)" || echo "✗ Upload failed: $f"
|
|
done
|
|
|
|
build-macos-arm64:
|
|
runs-on: macos-arm64
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
git init
|
|
git remote add origin http://172.0.0.29:3000/sarman/tftsr-devops_investigation.git
|
|
git fetch --depth=1 origin $GITHUB_SHA
|
|
git checkout FETCH_HEAD
|
|
- name: Build
|
|
env:
|
|
MACOSX_DEPLOYMENT_TARGET: "11.0"
|
|
run: |
|
|
npm ci --legacy-peer-deps
|
|
rustup target add aarch64-apple-darwin
|
|
cargo install tauri-cli --version "^2" --locked
|
|
# Build the .app bundle only (no DMG yet so we can sign before packaging)
|
|
CI=true cargo tauri build --target aarch64-apple-darwin --bundles app
|
|
APP=$(find src-tauri/target/aarch64-apple-darwin/release/bundle/macos -maxdepth 1 -type d -name "*.app" | head -n 1)
|
|
if [ -z "$APP" ]; then
|
|
echo "ERROR: Could not find macOS app bundle"
|
|
exit 1
|
|
fi
|
|
APP_NAME=$(basename "$APP" .app)
|
|
# Ad-hoc sign: changes Gatekeeper error from "damaged" to "unidentified developer"
|
|
codesign --deep --force --sign - "$APP"
|
|
# Create DMG from the signed .app
|
|
mkdir -p src-tauri/target/aarch64-apple-darwin/release/bundle/dmg
|
|
DMG=src-tauri/target/aarch64-apple-darwin/release/bundle/dmg/${APP_NAME}.dmg
|
|
hdiutil create -volname "$APP_NAME" -srcfolder "$APP" -ov -format UDZO "$DMG"
|
|
- name: Upload artifacts
|
|
env:
|
|
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
run: |
|
|
API="http://172.0.0.29:3000/api/v1/repos/$GITHUB_REPOSITORY"
|
|
TAG="$GITHUB_REF_NAME"
|
|
# Create release (idempotent)
|
|
echo "Creating release for $TAG..."
|
|
curl -sf -X POST "$API/releases" \
|
|
-H "Authorization: token $RELEASE_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"tag_name\":\"$TAG\",\"name\":\"TFTSR $TAG\",\"body\":\"Release $TAG\",\"draft\":false}" || true
|
|
# Get release ID
|
|
RELEASE_ID=$(curl -sf "$API/releases/tags/$TAG" \
|
|
-H "Authorization: token $RELEASE_TOKEN" | jq -r '.id')
|
|
if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "null" ]; then
|
|
echo "ERROR: Failed to get release ID for $TAG"
|
|
echo "Attempting to list recent releases..."
|
|
curl -sf "$API/releases" -H "Authorization: token $RELEASE_TOKEN" | jq -r '.[] | "\(.tag_name): \(.id)"' | head -5
|
|
exit 1
|
|
fi
|
|
echo "Release ID: $RELEASE_ID"
|
|
# Upload DMG
|
|
find src-tauri/target/aarch64-apple-darwin/release/bundle -name "*.dmg" | while read f; do
|
|
echo "Uploading $(basename $f)..."
|
|
curl -sf -X POST "$API/releases/$RELEASE_ID/assets" \
|
|
-H "Authorization: token $RELEASE_TOKEN" \
|
|
-F "attachment=@$f;filename=$(basename $f)" && echo "✓ Uploaded $(basename $f)" || echo "✗ Upload failed: $f"
|
|
done
|
|
|
|
build-linux-arm64:
|
|
runs-on: linux-arm64
|
|
container:
|
|
image: rust:1.88-slim
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
apt-get update -qq && apt-get install -y -qq git
|
|
git init
|
|
git remote add origin http://172.0.0.29:3000/sarman/tftsr-devops_investigation.git
|
|
git fetch --depth=1 origin $GITHUB_SHA
|
|
git checkout FETCH_HEAD
|
|
- name: Install dependencies
|
|
run: |
|
|
# Native ARM64 build (no cross-compilation needed)
|
|
apt-get update -qq && apt-get install -y -qq \
|
|
libwebkit2gtk-4.1-dev libssl-dev libgtk-3-dev \
|
|
libayatana-appindicator3-dev librsvg2-dev patchelf \
|
|
pkg-config curl perl jq
|
|
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
|
apt-get install -y nodejs
|
|
- name: Build
|
|
run: |
|
|
npm ci --legacy-peer-deps
|
|
cargo install tauri-cli --version "^2" --locked
|
|
# Native ARM64 build - no explicit target needed
|
|
CI=true cargo tauri build
|
|
- name: Upload artifacts
|
|
env:
|
|
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
run: |
|
|
API="http://172.0.0.29:3000/api/v1/repos/$GITHUB_REPOSITORY"
|
|
TAG="$GITHUB_REF_NAME"
|
|
echo "Creating release for $TAG..."
|
|
curl -sf -X POST "$API/releases" \
|
|
-H "Authorization: token $RELEASE_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"tag_name\":\"$TAG\",\"name\":\"TFTSR $TAG\",\"body\":\"Release $TAG\",\"draft\":false}" || true
|
|
RELEASE_ID=$(curl -sf "$API/releases/tags/$TAG" \
|
|
-H "Authorization: token $RELEASE_TOKEN" | jq -r '.id')
|
|
if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "null" ]; then
|
|
echo "ERROR: Failed to get release ID for $TAG"
|
|
exit 1
|
|
fi
|
|
echo "Release ID: $RELEASE_ID"
|
|
find src-tauri/target/release/bundle \
|
|
\( -name "*.deb" -o -name "*.rpm" -o -name "*.AppImage" \) | while read f; do
|
|
echo "Uploading $(basename $f)..."
|
|
curl -sf -X POST "$API/releases/$RELEASE_ID/assets" \
|
|
-H "Authorization: token $RELEASE_TOKEN" \
|
|
-F "attachment=@$f;filename=$(basename $f)" && echo "✓ Uploaded $(basename $f)" || echo "✗ Upload failed: $f"
|
|
done
|