From 6959329fd6d6f3a069b76702d43787b30c5da0c5 Mon Sep 17 00:00:00 2001 From: Minh141120 Date: Mon, 15 Sep 2025 09:32:51 +0700 Subject: [PATCH 1/3] chore: add install-rust-targets step for macOS universal builds --- .../template-tauri-build-macos-external.yml | 1 - .github/workflows/template-tauri-build-macos.yml | 1 - Makefile | 16 ++++++++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/template-tauri-build-macos-external.yml b/.github/workflows/template-tauri-build-macos-external.yml index e69e298a6..8f61b86fa 100644 --- a/.github/workflows/template-tauri-build-macos-external.yml +++ b/.github/workflows/template-tauri-build-macos-external.yml @@ -89,7 +89,6 @@ jobs: - name: Build app run: | - rustup target add x86_64-apple-darwin make build env: APP_PATH: '.' diff --git a/.github/workflows/template-tauri-build-macos.yml b/.github/workflows/template-tauri-build-macos.yml index 40cf4e839..332ecc42f 100644 --- a/.github/workflows/template-tauri-build-macos.yml +++ b/.github/workflows/template-tauri-build-macos.yml @@ -167,7 +167,6 @@ jobs: - name: Build app run: | - rustup target add x86_64-apple-darwin make build env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Makefile b/Makefile index 457f314ef..65fc67fc4 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,17 @@ endif yarn build:core yarn build:extensions && yarn build:extensions-web +# Install required Rust targets for macOS universal builds +install-rust-targets: +ifeq ($(shell uname -s),Darwin) + @echo "Detected macOS, installing universal build targets..." + rustup target add x86_64-apple-darwin + rustup target add aarch64-apple-darwin + @echo "Rust targets installed successfully!" +else + @echo "Not macOS; skipping Rust target installation." +endif + dev: install-and-build yarn download:bin yarn download:lib @@ -68,11 +79,12 @@ test: lint cargo test --manifest-path src-tauri/utils/Cargo.toml # Builds and publishes the app -build-and-publish: install-and-build +build-and-publish: install-and-build install-rust-targets yarn build # Build -build: install-and-build +build: install-and-build install-rust-targets + install-rust-targets yarn download:lib yarn build From 4fa78fa8920f08f366759f1d3e721b055d4147aa Mon Sep 17 00:00:00 2001 From: Minh141120 Date: Mon, 15 Sep 2025 09:44:21 +0700 Subject: [PATCH 2/3] fix: make install-rust-targets a dependency --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 65fc67fc4..72aca58c1 100644 --- a/Makefile +++ b/Makefile @@ -84,7 +84,6 @@ build-and-publish: install-and-build install-rust-targets # Build build: install-and-build install-rust-targets - install-rust-targets yarn download:lib yarn build From 1db67ea9a2d2638d866cd77eb86c32c2e2d9d234 Mon Sep 17 00:00:00 2001 From: Minh141120 Date: Mon, 15 Sep 2025 11:24:11 +0700 Subject: [PATCH 3/3] chore: simplify macos workflow --- .../workflows/template-tauri-build-macos.yml | 25 ------------------- Makefile | 1 + 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/.github/workflows/template-tauri-build-macos.yml b/.github/workflows/template-tauri-build-macos.yml index 332ecc42f..4646041cf 100644 --- a/.github/workflows/template-tauri-build-macos.yml +++ b/.github/workflows/template-tauri-build-macos.yml @@ -92,31 +92,6 @@ jobs: run: | cargo install ctoml - - name: Create bun and uv universal - run: | - mkdir -p ./src-tauri/resources/bin/ - cd ./src-tauri/resources/bin/ - curl -L -o bun-darwin-x64.zip https://github.com/oven-sh/bun/releases/download/bun-v1.2.10/bun-darwin-x64.zip - curl -L -o bun-darwin-aarch64.zip https://github.com/oven-sh/bun/releases/download/bun-v1.2.10/bun-darwin-aarch64.zip - unzip bun-darwin-x64.zip - unzip bun-darwin-aarch64.zip - lipo -create -output bun-universal-apple-darwin bun-darwin-x64/bun bun-darwin-aarch64/bun - cp -f bun-darwin-aarch64/bun bun-aarch64-apple-darwin - cp -f bun-darwin-x64/bun bun-x86_64-apple-darwin - cp -f bun-universal-apple-darwin bun - - curl -L -o uv-x86_64.tar.gz https://github.com/astral-sh/uv/releases/download/0.6.17/uv-x86_64-apple-darwin.tar.gz - curl -L -o uv-arm64.tar.gz https://github.com/astral-sh/uv/releases/download/0.6.17/uv-aarch64-apple-darwin.tar.gz - tar -xzf uv-x86_64.tar.gz - tar -xzf uv-arm64.tar.gz - mv uv-x86_64-apple-darwin uv-x86_64 - mv uv-aarch64-apple-darwin uv-aarch64 - lipo -create -output uv-universal-apple-darwin uv-x86_64/uv uv-aarch64/uv - cp -f uv-x86_64/uv uv-x86_64-apple-darwin - cp -f uv-aarch64/uv uv-aarch64-apple-darwin - cp -f uv-universal-apple-darwin uv - ls -la - - name: Update app version based on latest release tag with build number run: | echo "Version: ${{ inputs.new_version }}" diff --git a/Makefile b/Makefile index 72aca58c1..b960b67aa 100644 --- a/Makefile +++ b/Makefile @@ -84,6 +84,7 @@ build-and-publish: install-and-build install-rust-targets # Build build: install-and-build install-rust-targets + yarn download:bin yarn download:lib yarn build