Skip to content

Commit

Permalink
Sign and staple apple DMG
Browse files Browse the repository at this point in the history
  • Loading branch information
adityapk00 committed Dec 3, 2019
1 parent 77c1241 commit 21e3c42
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/scripts/dounifiedbuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ param (
[Parameter(Mandatory=$true)][string]$version,
[Parameter(Mandatory=$true)][string]$prev,
[Parameter(Mandatory=$true)][string]$certificate,
[Parameter(Mandatory=$true)][string]$username,
[Parameter(Mandatory=$true)][string]$password,
[Parameter(Mandatory=$true)][string]$server,
[Parameter(Mandatory=$true)][string]$winserver
)


Write-Host "[Initializing]"
Remove-Item -Force -ErrorAction Ignore ./artifacts/linux-binaries-zecwallet-lite-v$version.tar.gz
Remove-Item -Force -ErrorAction Ignore ./artifacts/linux-deb-zecwallet-lite-v$version.deb
Expand All @@ -28,7 +31,7 @@ Write-Host ""


Write-Host "[Building on Mac]"
bash src/scripts/mkmacdmg.sh --qt_path ~/Qt/5.11.1/clang_64/ --version $version --certificate "$certificate"
bash src/scripts/mkmacdmg.sh --qt_path ~/Qt/5.11.1/clang_64/ --version $version --certificate "$certificate" --username "$username" --password "$password"
if (! $?) {
Write-Output "[Error]"
exit 1;
Expand Down
34 changes: 30 additions & 4 deletions src/scripts/mkmacdmg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ case $key in
shift # past argument
shift # past value
;;
-u|--username)
APPLE_USERNAME="$2"
shift # past argument
shift # past value
;;
-p|--password)
APPLE_PASSWORD="$2"
shift # past argument
shift # past value
;;
-v|--version)
APP_VERSION="$2"
shift # past argument
Expand All @@ -35,11 +45,21 @@ if [ -z $QT_PATH ]; then
exit 1;
fi

if [ -z $CERTIFICATE ]; then
if [ -z "$CERTIFICATE" ]; then
echo "CERTIFICATE is not set. Please set it the name of the MacOS developer certificate to sign the binary with";
exit 1;
fi

if [ -z "$APPLE_USERNAME" ]; then
echo "APPLE_USERNAME is not set. Please set it the name of the MacOS developer login email to submit the binary for Apple for notarization";
exit 1;
fi

if [ -z "$APPLE_PASSWORD" ]; then
echo "APPLE_PASSWORD is not set. Please set it the name of the MacOS developer Application password to submit the binary for Apple for notarization";
exit 1;
fi

if [ -z $APP_VERSION ]; then
echo "APP_VERSION is not set. Please set it to the current release version of the app";
exit 1;
Expand Down Expand Up @@ -76,8 +96,9 @@ echo -n "Deploying.............."
mkdir artifacts >/dev/null 2>&1
rm -f artifcats/zecwallet-lite.dmg >/dev/null 2>&1
rm -f artifacts/rw* >/dev/null 2>&1
$QT_PATH/bin/macdeployqt zecwallet-lite.app
codesign --deep --force --verify --verbose -s "$CERTIFICATE" --options runtime --timestamp zecwallet-lite.app/
mv zecwallet-lite.app Zecwallet-Lite.app
$QT_PATH/bin/macdeployqt Zecwallet-Lite.app
codesign --deep --force --verify --verbose -s "$CERTIFICATE" --options runtime --timestamp Zecwallet-Lite.app
echo "[OK]"


Expand All @@ -89,11 +110,16 @@ echo "[OK]"
# xcrun stapler staple macOS-zecwallet-lite-v1.0.0.dmg

echo -n "Building dmg..........."
mv zecwallet-lite.app Zecwallet-Lite.app

create-dmg --volname "Zecwallet-Lite-v$APP_VERSION" --volicon "res/logo.icns" --window-pos 200 120 --icon "Zecwallet-Lite.app" 200 190 --app-drop-link 600 185 --hide-extension "Zecwallet-Lite.app" --window-size 800 400 --hdiutil-quiet --background res/dmgbg.png artifacts/macOS-zecwallet-lite-v$APP_VERSION.dmg Zecwallet-Lite.app >/dev/null 2>&1

if [ ! -f artifacts/macOS-zecwallet-lite-v$APP_VERSION.dmg ]; then
echo "[ERROR]"
exit 1
fi
echo "[OK]"

# Submit to Apple for notarization
echo -n "Apple notarization....."
xcrun altool --notarize-app -t osx -f artifacts/macOS-zecwallet-lite-v$APP_VERSION.dmg --primary-bundle-id="com.yourcompany.zecwallet-lite" -u "$APPLE_USERNAME" -p "$APPLE_PASSWORD"
echo "[OK]"
3 changes: 3 additions & 0 deletions src/scripts/signbinaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ if [ -z $APP_VERSION ]; then echo "APP_VERSION is not set"; exit 1; fi
rm -rf release/signatures
mkdir -p release/signatures

# Staple the notarization
xcrun stapler staple artifacts/macOS-zecwallet-lite-v$APP_VERSION.dmg

cd artifacts

# Remove previous signatures/hashes
Expand Down

0 comments on commit 21e3c42

Please sign in to comment.