mac-dmg-x64.yml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. name: Build macOS .dmg for x64
  2. #######################################
  3. # STOP! DO NOT EDIT THIS FILE!
  4. #
  5. # It is a copy of mac-dmg.yml with tiny adjustements (mainly lines 42 to 47)
  6. # It was made necessary, since Github does not offer free macos intel runners for macos 15 and above.
  7. #
  8. #######################################
  9. on:
  10. release:
  11. types: [published]
  12. workflow_dispatch:
  13. inputs:
  14. version:
  15. description: 'Version'
  16. required: false
  17. notarize:
  18. description: 'Notarize'
  19. required: true
  20. default: false
  21. type: boolean
  22. env:
  23. JAVA_DIST: 'temurin'
  24. JAVA_VERSION: '24.0.1+9'
  25. jobs:
  26. get-version:
  27. uses: ./.github/workflows/get-version.yml
  28. with:
  29. version: ${{ inputs.version }}
  30. build-arm:
  31. name: Build Cryptomator.app for ${{ matrix.output-suffix }}
  32. runs-on: ${{ matrix.os }}
  33. needs: [get-version]
  34. strategy:
  35. fail-fast: false
  36. matrix:
  37. include:
  38. - os: macos-15-large
  39. architecture: x64
  40. output-suffix: x64
  41. fuse-lib: macFUSE
  42. openjfx-url: 'https://download2.gluonhq.com/openjfx/24.0.1/openjfx-24.0.1_osx-x64_bin-jmods.zip'
  43. openjfx-sha: '6e62a426d43c168a488521f904a523f3dd6ee2cf103e08136f2fd465c828a105'
  44. steps:
  45. - uses: actions/checkout@v4
  46. - name: Setup Java
  47. uses: actions/setup-java@v4
  48. with:
  49. distribution: ${{ env.JAVA_DIST }}
  50. java-version: ${{ env.JAVA_VERSION }}
  51. architecture: ${{ matrix.architecture }}
  52. check-latest: true
  53. cache: 'maven'
  54. - name: Download OpenJFX jmods
  55. id: download-jmods
  56. run: |
  57. curl -L ${{ matrix.openjfx-url }} -o openjfx-jmods.zip
  58. echo "${{ matrix.openjfx-sha }} *openjfx-jmods.zip" | shasum -a256 --check
  59. mkdir -p openjfx-jmods/
  60. unzip -jo openjfx-jmods.zip \*/javafx.base.jmod \*/javafx.controls.jmod \*/javafx.fxml.jmod \*/javafx.graphics.jmod -d openjfx-jmods
  61. - name: Ensure major jfx version in pom and in jmods is the same
  62. run: |
  63. JMOD_VERSION=$(jmod describe openjfx-jmods/javafx.base.jmod | head -1)
  64. JMOD_VERSION=${JMOD_VERSION#*@}
  65. JMOD_VERSION=${JMOD_VERSION%%.*}
  66. POM_JFX_VERSION=$(mvn help:evaluate "-Dexpression=javafx.version" -q -DforceStdout)
  67. POM_JFX_VERSION=${POM_JFX_VERSION#*@}
  68. POM_JFX_VERSION=${POM_JFX_VERSION%%.*}
  69. if [ "${POM_JFX_VERSION}" -ne "${JMOD_VERSION}" ]; then
  70. >&2 echo "Major JavaFX version in pom.xml (${POM_JFX_VERSION}) != jmod version (${JMOD_VERSION})"
  71. exit 1
  72. fi
  73. - name: Set version
  74. run : mvn versions:set -DnewVersion=${{ needs.get-version.outputs.semVerStr }}
  75. - name: Run maven
  76. run: mvn -B -Djavafx.platform=mac clean package -Pmac -DskipTests
  77. - name: Patch target dir
  78. run: |
  79. cp LICENSE.txt target
  80. cp target/cryptomator-*.jar target/mods
  81. - name: Run jlink with help option
  82. id: jep-493-check
  83. run: |
  84. JMOD_PATHS="openjfx-jmods"
  85. if ! ${JAVA_HOME}/bin/jlink --help | grep -q "Linking from run-time image enabled"; then
  86. JMOD_PATHS="${JAVA_HOME}/jmods:${JMOD_PATHS}"
  87. fi
  88. echo "jmod_paths=${JMOD_PATHS}" >> "$GITHUB_OUTPUT"
  89. - name: Run jlink
  90. #Remark: no compression is applied for improved build compression later (here dmg)
  91. run: >
  92. ${JAVA_HOME}/bin/jlink
  93. --verbose
  94. --output runtime
  95. --module-path "${{ steps.jep-493-check.outputs.jmod_paths }}"
  96. --add-modules java.base,java.desktop,java.instrument,java.logging,java.naming,java.net.http,java.scripting,java.sql,java.xml,javafx.base,javafx.graphics,javafx.controls,javafx.fxml,jdk.unsupported,jdk.accessibility,jdk.management.jfr,java.compiler
  97. --strip-native-commands
  98. --no-header-files
  99. --no-man-pages
  100. --strip-debug
  101. --compress zip-0
  102. - name: Run jpackage
  103. run: >
  104. ${JAVA_HOME}/bin/jpackage
  105. --verbose
  106. --type app-image
  107. --runtime-image runtime
  108. --input target/libs
  109. --module-path target/mods
  110. --module org.cryptomator.desktop/org.cryptomator.launcher.Cryptomator
  111. --dest appdir
  112. --name Cryptomator
  113. --vendor "Skymatic GmbH"
  114. --copyright "(C) 2016 - 2025 Skymatic GmbH"
  115. --app-version "${{ needs.get-version.outputs.semVerNum }}"
  116. --java-options "--enable-preview"
  117. --java-options "--enable-native-access=javafx.graphics,org.cryptomator.jfuse.mac"
  118. --java-options "-Xss5m"
  119. --java-options "-Xmx256m"
  120. --java-options "-Dfile.encoding=\"utf-8\""
  121. --java-options "-Djava.net.useSystemProxies=true"
  122. --java-options "-Dapple.awt.enableTemplateImages=true"
  123. --java-options "-Dsun.java2d.metal=true"
  124. --java-options "-Dcryptomator.appVersion=\"${{ needs.get-version.outputs.semVerStr }}\""
  125. --java-options "-Dcryptomator.logDir=\"@{userhome}/Library/Logs/Cryptomator\""
  126. --java-options "-Dcryptomator.pluginDir=\"@{userhome}/Library/Application Support/Cryptomator/Plugins\""
  127. --java-options "-Dcryptomator.settingsPath=\"@{userhome}/Library/Application Support/Cryptomator/settings.json\""
  128. --java-options "-Dcryptomator.p12Path=\"@{userhome}/Library/Application Support/Cryptomator/key.p12\""
  129. --java-options "-Dcryptomator.ipcSocketPath=\"@{userhome}/Library/Application Support/Cryptomator/ipc.socket\""
  130. --java-options "-Dcryptomator.integrationsMac.keychainServiceName=\"Cryptomator\""
  131. --java-options "-Dcryptomator.mountPointsDir=\"@{userhome}/Library/Application Support/Cryptomator/mnt\""
  132. --java-options "-Dcryptomator.showTrayIcon=true"
  133. --java-options "-Dcryptomator.buildNumber=\"dmg-${{ needs.get-version.outputs.revNum }}\""
  134. --mac-package-identifier org.cryptomator
  135. --resource-dir dist/mac/resources
  136. - name: Patch Cryptomator.app
  137. run: |
  138. mv appdir/Cryptomator.app Cryptomator.app
  139. mv dist/mac/resources/Cryptomator-Vault.icns Cryptomator.app/Contents/Resources/
  140. sed -i '' "s|###BUNDLE_SHORT_VERSION_STRING###|${VERSION_NO}|g" Cryptomator.app/Contents/Info.plist
  141. sed -i '' "s|###BUNDLE_VERSION###|${REVISION_NO}|g" Cryptomator.app/Contents/Info.plist
  142. echo -n "$PROVISIONING_PROFILE_BASE64" | base64 --decode --output Cryptomator.app/Contents/embedded.provisionprofile
  143. env:
  144. VERSION_NO: ${{ needs.get-version.outputs.semVerNum }}
  145. REVISION_NO: ${{ needs.get-version.outputs.revNum }}
  146. PROVISIONING_PROFILE_BASE64: ${{ secrets.MACOS_PROVISIONING_PROFILE_BASE64 }}
  147. - name: Generate license for dmg
  148. run: >
  149. mvn -B -Djavafx.platform=mac license:add-third-party
  150. -Dlicense.thirdPartyFilename=license.rtf
  151. -Dlicense.outputDirectory=dist/mac/dmg/resources
  152. -Dlicense.fileTemplate=dist/mac/dmg/resources/licenseTemplate.ftl
  153. -Dlicense.includedScopes=compile
  154. -Dlicense.excludedGroups=^org\.cryptomator
  155. -Dlicense.failOnMissing=true
  156. -Dlicense.licenseMergesUrl=file://${{ github.workspace }}/license/merges
  157. - name: Install codesign certificate
  158. run: |
  159. # create variables
  160. CERTIFICATE_PATH=$RUNNER_TEMP/codesign.p12
  161. KEYCHAIN_PATH=$RUNNER_TEMP/codesign.keychain-db
  162. # import certificate and provisioning profile from secrets
  163. echo -n "$CODESIGN_P12_BASE64" | base64 --decode --output $CERTIFICATE_PATH
  164. # create temporary keychain
  165. security create-keychain -p "$CODESIGN_TMP_KEYCHAIN_PW" $KEYCHAIN_PATH
  166. security set-keychain-settings -lut 900 $KEYCHAIN_PATH
  167. security unlock-keychain -p "$CODESIGN_TMP_KEYCHAIN_PW" $KEYCHAIN_PATH
  168. # import certificate to keychain
  169. security import $CERTIFICATE_PATH -P "$CODESIGN_P12_PW" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
  170. security list-keychain -d user -s $KEYCHAIN_PATH
  171. env:
  172. CODESIGN_P12_BASE64: ${{ secrets.MACOS_CODESIGN_P12_BASE64 }}
  173. CODESIGN_P12_PW: ${{ secrets.MACOS_CODESIGN_P12_PW }}
  174. CODESIGN_TMP_KEYCHAIN_PW: ${{ secrets.MACOS_CODESIGN_TMP_KEYCHAIN_PW }}
  175. - name: Codesign
  176. run: |
  177. echo "Codesigning jdk files..."
  178. find Cryptomator.app/Contents/runtime/Contents/Home/lib/ -name '*.dylib' -exec codesign --force -s ${CODESIGN_IDENTITY} {} \;
  179. find Cryptomator.app/Contents/runtime/Contents/Home/lib/ \( -name 'jspawnhelper' -o -name 'pauseengine' -o -name 'simengine' \) -exec codesign --force -o runtime -s ${CODESIGN_IDENTITY} {} \;
  180. echo "Codesigning jar contents..."
  181. find Cryptomator.app/Contents/runtime/Contents/MacOS -name '*.dylib' -exec codesign --force -s ${CODESIGN_IDENTITY} {} \;
  182. for JAR_PATH in `find Cryptomator.app -name "*.jar"`; do
  183. if [[ `unzip -l ${JAR_PATH} | grep '.dylib\|.jnilib'` ]]; then
  184. JAR_FILENAME=$(basename ${JAR_PATH})
  185. OUTPUT_PATH=${JAR_PATH%.*}
  186. echo "Codesigning libs in ${JAR_FILENAME}..."
  187. unzip -q ${JAR_PATH} -d ${OUTPUT_PATH}
  188. find ${OUTPUT_PATH} -name '*.dylib' -exec codesign --force -s ${CODESIGN_IDENTITY} {} \;
  189. find ${OUTPUT_PATH} -name '*.jnilib' -exec codesign --force -s ${CODESIGN_IDENTITY} {} \;
  190. rm ${JAR_PATH}
  191. pushd ${OUTPUT_PATH} > /dev/null
  192. zip -qr ../${JAR_FILENAME} *
  193. popd > /dev/null
  194. rm -r ${OUTPUT_PATH}
  195. fi
  196. done
  197. echo "Codesigning Cryptomator.app..."
  198. sed -i '' "s|###APP_IDENTIFIER_PREFIX###|${TEAM_IDENTIFIER}.|g" dist/mac/Cryptomator.entitlements
  199. sed -i '' "s|###TEAM_IDENTIFIER###|${TEAM_IDENTIFIER}|g" dist/mac/Cryptomator.entitlements
  200. codesign --force --deep --entitlements dist/mac/Cryptomator.entitlements -o runtime -s ${CODESIGN_IDENTITY} Cryptomator.app
  201. env:
  202. CODESIGN_IDENTITY: ${{ secrets.MACOS_CODESIGN_IDENTITY }}
  203. TEAM_IDENTIFIER: ${{ secrets.MACOS_TEAM_IDENTIFIER }}
  204. - name: Prepare .dmg contents
  205. run: |
  206. mkdir dmg
  207. mv Cryptomator.app dmg
  208. cp dist/mac/dmg/resources/${{ matrix.fuse-lib }}.webloc dmg
  209. ls -l dmg
  210. - name: Install create-dmg
  211. run: |
  212. brew install create-dmg
  213. create-dmg --help
  214. - name: Create .dmg
  215. run: >
  216. create-dmg
  217. --volname Cryptomator
  218. --volicon "dist/mac/dmg/resources/Cryptomator-Volume.icns"
  219. --background "dist/mac/dmg/resources/Cryptomator-${{ matrix.fuse-lib }}-background.tiff"
  220. --window-pos 400 100
  221. --window-size 640 694
  222. --icon-size 128
  223. --icon "Cryptomator.app" 128 245
  224. --hide-extension "Cryptomator.app"
  225. --icon "${{ matrix.fuse-lib }}.webloc" 320 501
  226. --hide-extension "${{ matrix.fuse-lib }}.webloc"
  227. --app-drop-link 512 245
  228. --eula "dist/mac/dmg/resources/license.rtf"
  229. --icon ".background" 128 758
  230. --icon ".VolumeIcon.icns" 512 758
  231. Cryptomator-${VERSION_NO}-${{ matrix.output-suffix }}.dmg dmg
  232. env:
  233. VERSION_NO: ${{ needs.get-version.outputs.semVerNum }}
  234. - name: Notarize .dmg
  235. if: startsWith(github.ref, 'refs/tags/') || inputs.notarize
  236. uses: cocoalibs/xcode-notarization-action@v1
  237. with:
  238. app-path: 'Cryptomator-*.dmg'
  239. apple-id: ${{ secrets.MACOS_NOTARIZATION_APPLE_ID }}
  240. password: ${{ secrets.MACOS_NOTARIZATION_PW }}
  241. team-id: ${{ secrets.MACOS_NOTARIZATION_TEAM_ID }}
  242. xcode-path: '/Applications/Xcode_16.app'
  243. - name: Add possible alpha/beta tags to installer name
  244. run: mv Cryptomator-*.dmg Cryptomator-${{ needs.get-version.outputs.semVerStr }}-${{ matrix.output-suffix }}.dmg
  245. - name: Create detached GPG signature with key 615D449FE6E6A235
  246. run: |
  247. echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import
  248. echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a Cryptomator-*.dmg
  249. env:
  250. GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
  251. GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
  252. - name: Clean up codesign certificate
  253. if: ${{ always() }}
  254. run: security delete-keychain $RUNNER_TEMP/codesign.keychain-db
  255. continue-on-error: true
  256. - name: Upload artifacts
  257. uses: actions/upload-artifact@v4
  258. with:
  259. name: dmg-${{ matrix.output-suffix }}
  260. path: |
  261. Cryptomator-*.dmg
  262. Cryptomator-*.asc
  263. if-no-files-found: error
  264. - name: Publish dmg on GitHub Releases
  265. if: startsWith(github.ref, 'refs/tags/') && github.event.action == 'published'
  266. uses: softprops/action-gh-release@v2
  267. with:
  268. fail_on_unmatched_files: true
  269. token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
  270. files: |
  271. Cryptomator-*.dmg
  272. Cryptomator-*.asc