diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8d4807d..94bc1af 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,6 +24,7 @@ jobs: - name: Build MacTree.app env: SIGN_IDENTITY: "-" + UNIVERSAL: "1" BUILD_NUMBER: ${{ github.run_number }} run: | swift --version @@ -32,6 +33,7 @@ jobs: - name: Smoke test run: | + lipo build/MacTree.app/Contents/MacOS/MacTree -verify_arch arm64 x86_64 build/MacTree.app/Contents/MacOS/MacTree --bench "$GITHUB_WORKSPACE/Sources" codesign --verify --deep --strict build/MacTree.app diff --git a/scripts/build-app.sh b/scripts/build-app.sh index 37b6c90..a80be4a 100755 --- a/scripts/build-app.sh +++ b/scripts/build-app.sh @@ -5,15 +5,23 @@ # macOS keeps the Full Disk Access grant across rebuilds (an ad-hoc signature # changes every build and the grant stops applying). Override with # SIGN_IDENTITY="", or SIGN_IDENTITY=- for ad-hoc. +# +# UNIVERSAL=1 builds one binary for both Apple silicon and Intel Macs. set -euo pipefail cd "$(dirname "$0")/.." -swift build -c release +if [ -n "${UNIVERSAL:-}" ]; then + swift build -c release --arch arm64 --arch x86_64 + BINARY=.build/apple/Products/Release/MacTree +else + swift build -c release + BINARY=.build/release/MacTree +fi APP=build/MacTree.app rm -rf "$APP" mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources" -cp .build/release/MacTree "$APP/Contents/MacOS/MacTree" +cp "$BINARY" "$APP/Contents/MacOS/MacTree" cp Resources/Info.plist "$APP/Contents/Info.plist" cp -R Resources/*.lproj "$APP/Contents/Resources/"