source: josm/trunk/native/macosx/macos-jpackage.sh@ 17442

Last change on this file since 17442 was 17373, checked in by Don-vip, 3 years ago

see #20146 - Improvements to macOS build and github actions (patch by Stereo)

From https://github.com/openstreetmap/josm/pull/67:

  • Separate the create-release github action to pass the release url to all subsequent jobs, to be able to...
  • Upload .jar artefacts from all runs, and a separate .app for all java versions for macOS
  • Better caching for ant/junit
  • Support for the release workflow from #20146
  • A few cosmetic fixes, more readable syntax, etc.
  • Property svn:executable set to *
File size: 3.0 KB
Line 
1#!/bin/bash
2
3set -Eeou pipefail
4
5# Don't show one time passwords
6set +x
7
8SIGNING_KEY_NAME="Developer ID Application: FOSSGIS e.V. (P8AAAGN2AM)"
9IMPORT_AND_UNLOCK_KEYCHAIN=${IMPORT_AND_UNLOCK_KEYCHAIN:-1}
10
11if [ -z "${1-}" ]
12then
13 echo "Usage: $0 josm_revision"
14 exit 1
15fi
16
17echo "Building JOSM.app"
18
19mkdir app
20
21if [[ $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
35 echo "Preparing certificates/keychain for signing…"
36
37 KEYCHAIN=build.keychain
38 KEYCHAINPATH=~/Library/Keychains/$KEYCHAIN-db
39 KEYCHAIN_PW=`head /dev/urandom | base64 | head -c 20`
40 CERTIFICATE_P12=certificate.p12
41
42 echo $CERT_MACOS_P12 | base64 --decode > $CERTIFICATE_P12
43 security create-keychain -p $KEYCHAIN_PW $KEYCHAIN
44 security default-keychain -s $KEYCHAIN
45 security unlock-keychain -p $KEYCHAIN_PW $KEYCHAIN
46 security import $CERTIFICATE_P12 -k $KEYCHAIN -P $CERT_MACOS_PW -T /usr/bin/codesign
47 security set-key-partition-list -S apple-tool:,apple: -s -k $KEYCHAIN_PW $KEYCHAIN
48 rm $CERTIFICATE_P12
49
50 echo "Signing preparation done."
51fi
52
53echo "Building and signin app"
54 jpackage -n "JOSM" --input dist --main-jar josm-custom.jar \
55 --main-class org.openstreetmap.josm.gui.MainApplication \
56 --icon ./native/macosx/JOSM.icns --type app-image --dest app \
57 --java-options "-Xmx8192m" \
58 --java-options "-Dapple.awt.application.appearance=system" \
59 --app-version $1 \
60 --copyright "JOSM, and all its integral parts, are released under the GNU General Public License v2 or later" \
61 --vendor "https://josm.openstreetmap.de" \
62 --mac-sign \
63 --mac-package-identifier de.openstreetmap.josm \
64 --mac-package-signing-prefix de.openstreetmap.josm \
65 --mac-signing-keychain $KEYCHAINPATH \
66 --file-associations native/macosx/bz2.properties \
67 --file-associations native/macosx/geojson.properties \
68 --file-associations native/macosx/gpx.properties \
69 --file-associations native/macosx/gz.properties \
70 --file-associations native/macosx/jos.properties \
71 --file-associations native/macosx/joz.properties \
72 --file-associations native/macosx/osm.properties \
73 --file-associations native/macosx/zip.properties \
74 --add-modules java.base,java.datatransfer,java.desktop,java.logging,java.management,java.naming,java.net.http,java.prefs,java.rmi,java.scripting,java.sql,java.transaction.xa,java.xml,jdk.crypto.ec,jdk.jfr,jdk.jsobject,jdk.unsupported,jdk.unsupported.desktop,jdk.xml.dom
75
76echo "Building done."
77
78echo "Preparing for notarization"
79ditto -c -k --zlibCompressionLevel 9 --keepParent app/JOSM.app app/JOSM.zip
80
81echo "Uploading to Apple"
82xcrun altool --notarize-app -f app/JOSM.zip -p "$APPLE_ID_PW" -u "thomas.skowron@fossgis.de" --primary-bundle-id de.openstreetmap.josm
Note: See TracBrowser for help on using the repository browser.