build: cross compile binary packages (rpm/deb/dmg)

Windows build still has issues on aarch64 so we postpone that for now
This commit is contained in:
William Casarin
2024-11-29 16:35:45 -08:00
parent 2969db7e30
commit 9055d07844
4 changed files with 92 additions and 91 deletions

View File

@@ -6,6 +6,8 @@ set -o pipefail # Catch errors in pipelines
# Ensure the script is running in the correct directory
REQUIRED_DIR="notedeck"
ARCH=${ARCH:-"aarch64"}
TARGET=${TARGET:-${ARCH}-apple-darwin}
CURRENT_DIR=$(basename "$PWD")
if [ "$CURRENT_DIR" != "$REQUIRED_DIR" ]; then
@@ -40,7 +42,7 @@ fi
# Build the .app bundle
echo "Building .app bundle..."
cargo bundle --release
cargo bundle --release --target $TARGET
# Sign the app
echo "Codesigning the app..."
@@ -51,11 +53,11 @@ codesign \
--options runtime \
--entitlements entitlements.plist \
--sign "$NOTEDECK_APPLE_RELEASE_CERT_ID" \
target/release/bundle/osx/notedeck.app
target/${TARGET}/release/bundle/osx/notedeck.app
# Create a zip for notarization
echo "Creating zip for notarization..."
zip -r notedeck.zip target/release/bundle/osx/notedeck.app
zip -r notedeck.zip target/${TARGET}/release/bundle/osx/notedeck.app
# Submit for notarization
echo "Submitting for notarization..."
@@ -68,7 +70,7 @@ xcrun notarytool submit \
# Staple the notarization
echo "Stapling notarization to the app..."
xcrun stapler staple target/release/bundle/osx/notedeck.app
xcrun stapler staple target/${TARGET}/release/bundle/osx/notedeck.app
echo "Removing notedeck.zip"
rm notedeck.zip
@@ -79,7 +81,7 @@ mkdir -p packages
create-dmg \
--window-size 600 400 \
--app-drop-link 400 100 \
packages/notedeck.dmg \
target/release/bundle/osx/notedeck.app
packages/notedeck-${ARCH}.dmg \
target/${TARGET}/release/bundle/osx/notedeck.app
echo "Build and signing process completed successfully."