From 17663aeb73151cc46ba3d815617ca4b0806054e5 Mon Sep 17 00:00:00 2001 From: Subhamoy Biswas Date: Tue, 17 Dec 2024 21:14:28 +0530 Subject: [PATCH] (ci/cd): fixed macOS cpu arch target for external binaries --- .github/workflows/release.yml | 5 +++++ src-tauri/tauri.macos.conf.json | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 41b9495..76b1dd2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,12 +14,16 @@ jobs: include: - platform: 'macos-latest' args: '--target aarch64-apple-darwin' + arch: 'aarch64-apple-darwin' - platform: 'macos-latest' args: '--target x86_64-apple-darwin' + arch: 'x86_64-apple-darwin' - platform: 'ubuntu-22.04' args: '' + arch: '' - platform: 'windows-latest' args: '' + arch: '' runs-on: ${{ matrix.platform }} steps: @@ -55,6 +59,7 @@ jobs: uses: tauri-apps/tauri-action@v0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TARGET_ARCH: ${{ matrix.arch }} with: tagName: ${{ github.ref_name }} releaseName: ${{ github.event.repository.name }}-${{ github.ref_name }} diff --git a/src-tauri/tauri.macos.conf.json b/src-tauri/tauri.macos.conf.json index cb6a1f6..752d5d2 100644 --- a/src-tauri/tauri.macos.conf.json +++ b/src-tauri/tauri.macos.conf.json @@ -1,7 +1,7 @@ { "build": { - "beforeDevCommand": "cargo build --manifest-path=./src-tauri/msghost/Cargo.toml && cargo build --manifest-path=./src-tauri/autostart/Cargo.toml && npm run dev", - "beforeBuildCommand": "cargo build --release --manifest-path=./src-tauri/msghost/Cargo.toml && cargo build --release --manifest-path=./src-tauri/autostart/Cargo.toml && node copyMacFiles.js && npm run build", + "beforeBuildCommand": "[[ -n \"$TARGET_ARCH\" ]] && ARCH=\"$TARGET_ARCH\" || ARCH=\"$(uname -m | sed 's/^arm64$/aarch64/')-apple-darwin\" && cargo build --release --target=$ARCH --manifest-path=./src-tauri/msghost/Cargo.toml && cargo build --release --target=$ARCH --manifest-path=./src-tauri/autostart/Cargo.toml && node copyMacFiles.js && npm run build", + "beforeDevCommand": "[[ -n \"$TARGET_ARCH\" ]] && ARCH=\"$TARGET_ARCH\" || ARCH=\"$(uname -m | sed 's/^arm64$/aarch64/')-apple-darwin\" && cargo build --target=$ARCH --manifest-path=./src-tauri/msghost/Cargo.toml && cargo build --target=$ARCH --manifest-path=./src-tauri/autostart/Cargo.toml && npm run dev", "devPath": "http://localhost:1422", "distDir": "../dist" },