mac-dmg-x64.yml 13 KB

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