Changeset 17487 in josm for trunk/native/macosx/macos-jpackage.sh
- Timestamp:
- 2021-02-08T20:52:53+01:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/native/macosx/macos-jpackage.sh
r17373 r17487 1 1 #!/bin/bash 2 3 ## Expected environment, passed from GitHub secrets: 4 # https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets 5 # APPLE_ID_PW Password for the Apple ID 6 # CERT_MACOS_P12 Certificate used for code signing, base64 encoded 7 # CERT_MACOS_PW Password for that certificate 2 8 3 9 set -Eeou pipefail … … 6 12 set +x 7 13 8 SIGNING_KEY_NAME="Developer ID Application: FOSSGIS e.V. (P8AAAGN2AM)"14 APPLE_ID="thomas.skowron@fossgis.de" 9 15 IMPORT_AND_UNLOCK_KEYCHAIN=${IMPORT_AND_UNLOCK_KEYCHAIN:-1} 10 16 … … 19 25 mkdir app 20 26 21 if [[ $IMPORT_AND_UNLOCK_KEYCHAIN == 1 ]]; then 22 if [ -z "$CERT_MACOS_P12" ] 23 then 24 echo "CERT_MACOS_P12 must be set in the environment. Won't sign app." 25 exit 1 26 fi 27 28 29 if [ -z "$CERT_MACOS_PW" ] 30 then 31 echo "CERT_MACOS_P12 must be set in the environment. Won't sign app." 32 exit 1 33 fi 34 27 if [ -z "$CERT_MACOS_P12" ] || [ -z "$CERT_MACOS_PW" ] || [ -z "$APPLE_ID_PW" ] 28 then 29 echo "CERT_MACOS_P12, CERT_MACOS_PW and APPLE_ID_PW are not set in the environment." 30 echo "I will create a JOSM.app but I won't attempt to sign and notarize it." 31 SIGNAPP=false 32 else 35 33 echo "Preparing certificates/keychain for signing…" 36 34 37 35 KEYCHAIN=build.keychain 38 36 KEYCHAINPATH=~/Library/Keychains/$KEYCHAIN-db 39 KEYCHAIN_PW= `head /dev/urandom | base64 | head -c 20`37 KEYCHAIN_PW=$(head /dev/urandom | base64 | head -c 20) 40 38 CERTIFICATE_P12=certificate.p12 41 39 42 echo $CERT_MACOS_P12| base64 --decode > $CERTIFICATE_P1243 security create-keychain -p $KEYCHAIN_PW$KEYCHAIN40 echo "$CERT_MACOS_P12" | base64 --decode > $CERTIFICATE_P12 41 security create-keychain -p "$KEYCHAIN_PW" $KEYCHAIN 44 42 security default-keychain -s $KEYCHAIN 45 security unlock-keychain -p $KEYCHAIN_PW$KEYCHAIN46 security import $CERTIFICATE_P12 -k $KEYCHAIN -P $CERT_MACOS_PW-T /usr/bin/codesign47 security set-key-partition-list -S apple-tool:,apple: -s -k $KEYCHAIN_PW$KEYCHAIN43 security unlock-keychain -p "$KEYCHAIN_PW" $KEYCHAIN 44 security import $CERTIFICATE_P12 -k $KEYCHAIN -P "$CERT_MACOS_PW" -T /usr/bin/codesign 45 security set-key-partition-list -S apple-tool:,apple: -s -k "$KEYCHAIN_PW" $KEYCHAIN 48 46 rm $CERTIFICATE_P12 49 47 SIGNAPP=true 50 48 echo "Signing preparation done." 51 49 fi 52 50 51 if $SIGNAPP; then 52 JPACKAGEOPTIONS="--mac-sign --mac-signing-keychain $KEYCHAINPATH" 53 else 54 JPACKAGEOPTIONS="" 55 fi 56 53 57 echo "Building and signin app" 54 jpackage -n "JOSM" --input dist --main-jar josm-custom.jar \58 jpackage $JPACKAGEOPTIONS -n "JOSM" --input dist --main-jar josm-custom.jar \ 55 59 --main-class org.openstreetmap.josm.gui.MainApplication \ 56 60 --icon ./native/macosx/JOSM.icns --type app-image --dest app \ 57 61 --java-options "-Xmx8192m" \ 58 --java-options "-Dapple.awt.application.appearance=system" \ 59 --app-version $1 \ 62 --app-version "$1" \ 60 63 --copyright "JOSM, and all its integral parts, are released under the GNU General Public License v2 or later" \ 61 64 --vendor "https://josm.openstreetmap.de" \ … … 76 79 echo "Building done." 77 80 78 echo "Preparing for notarization" 79 ditto -c -k --zlibCompressionLevel 9 --keepParent app/JOSM.app app/JOSM.zip 81 if $SIGNAPP; then 82 echo "Preparing for notarization" 83 ditto -c -k --zlibCompressionLevel 9 --keepParent app/JOSM.app app/JOSM.zip 80 84 81 echo "Uploading to Apple" 82 xcrun altool --notarize-app -f app/JOSM.zip -p "$APPLE_ID_PW" -u "thomas.skowron@fossgis.de" --primary-bundle-id de.openstreetmap.josm 85 echo "Uploading to Apple" 86 xcrun altool --notarize-app -f app/JOSM.zip -p "$APPLE_ID_PW" -u "$APPLE_ID" --primary-bundle-id de.openstreetmap.josm 87 fi
Note:
See TracChangeset
for help on using the changeset viewer.