Skip to content

An open-source cross-platform alternative to AirDrop

ci: tarball macos cli

Tien Do Nam82471a523411
diff --git a/support/scripts/compile_mac_cli.sh b/support/scripts/compile_mac_cli.sh
index 6c7ed7bf..313959fe 100644
--- a/support/scripts/compile_mac_cli.sh
+++ b/support/scripts/compile_mac_cli.sh
@@ -1,6 +1,6 @@
VERSION=$(sed -n 's/^version: \([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p' app/pubspec.yaml)
-ARM_BIN="LocalSend-CLI-$VERSION-macos-arm-64"
-X64_BIN="LocalSend-CLI-$VERSION-macos-x86-64"
+ARM_NAME="LocalSend-CLI-$VERSION-macos-arm-64"
+X64_NAME="LocalSend-CLI-$VERSION-macos-x86-64"
rustup target add aarch64-apple-darwin x86_64-apple-darwin
@@ -10,19 +10,21 @@ echo
cargo build --release --package localsend-cli --target aarch64-apple-darwin
cargo build --release --package localsend-cli --target x86_64-apple-darwin
-rm -f "$ARM_BIN" "$X64_BIN" "$ARM_BIN.zip" "$X64_BIN.zip"
-cp target/aarch64-apple-darwin/release/localsend-cli "$ARM_BIN"
-cp target/x86_64-apple-darwin/release/localsend-cli "$X64_BIN"
+# stage per-arch directories so the archived binary keeps its plain name
+rm -rf "$ARM_NAME" "$X64_NAME" "$ARM_NAME.zip" "$X64_NAME.zip" "$ARM_NAME.tar.gz" "$X64_NAME.tar.gz"
+mkdir "$ARM_NAME" "$X64_NAME"
+cp target/aarch64-apple-darwin/release/localsend-cli "$ARM_NAME/localsend-cli"
+cp target/x86_64-apple-darwin/release/localsend-cli "$X64_NAME/localsend-cli"
# sign the binaries
echo
echo "Signing the CLI..."
echo
SIGN_ID="Developer ID Application: Tien Do Nam (3W7H4PYMCV)"
-codesign --force --verbose --options runtime --sign "$SIGN_ID" "$ARM_BIN"
-codesign --force --verbose --options runtime --sign "$SIGN_ID" "$X64_BIN"
+codesign --force --verbose --options runtime --sign "$SIGN_ID" "$ARM_NAME/localsend-cli"
+codesign --force --verbose --options runtime --sign "$SIGN_ID" "$X64_NAME/localsend-cli"
-# send to apple for notarization
+# send to apple for notarization (the zip is only the submission transport)
APP_PASSWORD=abcd-efgh-ijkl-mnop
TEAM_ID=3W7H4PYMCV
@@ -30,10 +32,18 @@ TEAM_ID=3W7H4PYMCV
echo
echo "Sending to apple for notarization..."
echo
-zip "$ARM_BIN.zip" "$ARM_BIN"
-zip "$X64_BIN.zip" "$X64_BIN"
-xcrun notarytool submit "$ARM_BIN.zip" --wait --apple-id $DEV_EMAIL --password "$APP_PASSWORD" --team-id "$TEAM_ID"
-xcrun notarytool submit "$X64_BIN.zip" --wait --apple-id $DEV_EMAIL --password "$APP_PASSWORD" --team-id "$TEAM_ID"
+zip -j "$ARM_NAME.zip" "$ARM_NAME/localsend-cli"
+zip -j "$X64_NAME.zip" "$X64_NAME/localsend-cli"
+xcrun notarytool submit "$ARM_NAME.zip" --wait --apple-id $DEV_EMAIL --password "$APP_PASSWORD" --team-id "$TEAM_ID"
+xcrun notarytool submit "$X64_NAME.zip" --wait --apple-id $DEV_EMAIL --password "$APP_PASSWORD" --team-id "$TEAM_ID"
# bare binaries cannot be stapled; Gatekeeper fetches the ticket online
-rm -f "$ARM_BIN.zip" "$X64_BIN.zip"
+rm -f "$ARM_NAME.zip" "$X64_NAME.zip"
+
+# distribution tarballs; tar preserves the executable bit
+echo
+echo "Creating tar.gz archives..."
+echo
+tar -czvf "$ARM_NAME.tar.gz" -C "$ARM_NAME" localsend-cli
+tar -czvf "$X64_NAME.tar.gz" -C "$X64_NAME" localsend-cli
+rm -rf "$ARM_NAME" "$X64_NAME"