-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
55 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,59 @@ | ||
#!/usr/bin/bash | ||
|
||
if [ $1 != "" ]; then | ||
VERSION=$0 | ||
if [[ -n "$1" ]]; then | ||
VERSION=$0 | ||
else | ||
VERSION=$(LC_ALL=C sed -n -e '/^VERSION/p' qView.pro) | ||
VERSION=${VERSION: -3} | ||
VERSION=$(LC_ALL=C sed -n -e '/^VERSION/p' qView.pro) | ||
VERSION=${VERSION: -3} | ||
fi | ||
|
||
cd bin | ||
|
||
if [[ -n "$APPLE_DEVID_APP_CERT_DATA" ]]; then | ||
CODESIGN_CERT_PATH=$RUNNER_TEMP/codesign.p12 | ||
KEYCHAIN_PATH=$RUNNER_TEMP/codesign.keychain-db | ||
KEYCHAIN_PASS=$(uuidgen) | ||
|
||
echo -n "$APPLE_DEVID_APP_CERT_DATA" | base64 --decode -o "$CODESIGN_CERT_PATH" | ||
|
||
security create-keychain -p "$KEYCHAIN_PASS" "$KEYCHAIN_PATH" | ||
security unlock-keychain -p "$KEYCHAIN_PASS" "$KEYCHAIN_PATH" | ||
security import "$CODESIGN_CERT_PATH" -P "$APPLE_DEVID_APP_CERT_PASS" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH" | ||
security set-key-partition-list -S apple-tool:,apple: -s -k "$KEYCHAIN_PASS" "$KEYCHAIN_PATH" | ||
security list-keychains -d user -s "$KEYCHAIN_PATH" | ||
|
||
CODESIGN_CERT_NAME=$(openssl pkcs12 -in "$CODESIGN_CERT_PATH" -passin pass:"$APPLE_DEVID_APP_CERT_PASS" -nokeys -clcerts -info 2>&1 | openssl x509 -noout -subject -nameopt multiline | grep commonName | awk -F'= ' '{print $2}') | ||
else | ||
CODESIGN_CERT_NAME=- | ||
fi | ||
|
||
echo "Running macdeployqt" | ||
macdeployqt qView.app | ||
codesign --sign - --deep qView.app | ||
if [ $1 != "" ]; then | ||
|
||
echo "Running codesign" | ||
if [[ "$APPLE_NOTARIZE_REQUESTED" == "true" ]]; then | ||
APP_IDENTIFIER=$(/usr/libexec/PlistBuddy -c "Print CFBundleIdentifier" "qView.app/Contents/Info.plist") | ||
codesign --sign "$CODESIGN_CERT_NAME" --deep --options runtime --timestamp "qView.app" | ||
else | ||
codesign --sign "$CODESIGN_CERT_NAME" --deep "qView.app" | ||
fi | ||
|
||
echo "Creating disk image" | ||
if [[ -n "$1" ]]; then | ||
BUILD_NAME=qView-nightly-$1 | ||
DMG_FILENAME=$BUILD_NAME.dmg | ||
mv qView.app "$BUILD_NAME.app" | ||
hdiutil create -volname "$BUILD_NAME" -srcfolder "$BUILD_NAME.app" -fs HFS+ "$BUILD_NAME.dmg" | ||
hdiutil create -volname "$BUILD_NAME" -srcfolder "$BUILD_NAME.app" -fs HFS+ "$DMG_FILENAME" | ||
else | ||
DMG_FILENAME=qView-$VERSION.dmg | ||
brew install create-dmg | ||
create-dmg --volname "qView $VERSION" --window-size 660 400 --icon-size 160 --icon "qView.app" 180 170 --hide-extension qView.app --app-drop-link 480 170 "qView-$VERSION.dmg" "qView.app" | ||
create-dmg --volname "qView $VERSION" --window-size 660 400 --icon-size 160 --icon "qView.app" 180 170 --hide-extension qView.app --app-drop-link 480 170 "$DMG_FILENAME" "qView.app" | ||
fi | ||
if [[ "$APPLE_NOTARIZE_REQUESTED" == "true" ]]; then | ||
codesign --sign "$CODESIGN_CERT_NAME" --timestamp --identifier "$APP_IDENTIFIER.dmg" "$DMG_FILENAME" | ||
xcrun notarytool submit "$DMG_FILENAME" --apple-id "$APPLE_ID_USER" --password "$APPLE_ID_PASS" --team-id "${CODESIGN_CERT_NAME: -11:10}" --wait | ||
xcrun stapler staple "$DMG_FILENAME" | ||
xcrun stapler validate "$DMG_FILENAME" | ||
fi | ||
|
||
rm -r *.app |