appimage.yml 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. name: Build AppImage
  2. on:
  3. release:
  4. types: [published]
  5. workflow_dispatch:
  6. inputs:
  7. version:
  8. description: 'Version'
  9. required: false
  10. env:
  11. JAVA_DIST: 'temurin'
  12. JAVA_VERSION: 20
  13. jobs:
  14. get-version:
  15. uses: ./.github/workflows/get-version.yml
  16. with:
  17. version: ${{ inputs.version }}
  18. build:
  19. name: Build AppImage
  20. runs-on: ${{ matrix.os }}
  21. needs: [get-version]
  22. strategy:
  23. fail-fast: false
  24. matrix:
  25. include:
  26. - os: ubuntu-latest
  27. appimage-suffix: x86_64
  28. openjfx-url: 'https://download2.gluonhq.com/openjfx/20.0.2/openjfx-20.0.2_linux-x64_bin-jmods.zip'
  29. openjfx-sha: 'f522ac2ae4bdd61f0219b7b8d2058ff72a22f36a44378453bcfdcd82f8f5e08c'
  30. - os: [self-hosted, Linux, ARM64]
  31. appimage-suffix: aarch64
  32. openjfx-url: 'https://download2.gluonhq.com/openjfx/20.0.2/openjfx-20.0.2_linux-aarch64_bin-jmods.zip'
  33. openjfx-sha: 'c0d80ebbe0aab404ef9ad8b46c05bf533a1e40b39b2720eebd9238d81f6326ca'
  34. steps:
  35. - uses: actions/checkout@v4
  36. - name: Setup Java
  37. uses: actions/setup-java@v3
  38. with:
  39. distribution: ${{ env.JAVA_DIST }}
  40. java-version: ${{ env.JAVA_VERSION }}
  41. check-latest: true
  42. cache: 'maven'
  43. - name: Download OpenJFX jmods
  44. id: download-jmods
  45. run: |
  46. curl -L ${{ matrix.openjfx-url }} -o openjfx-jmods.zip
  47. echo "${{ matrix.openjfx-sha }} openjfx-jmods.zip" | shasum -a256 --check
  48. mkdir -p openjfx-jmods
  49. unzip -j openjfx-jmods.zip \*/javafx.base.jmod \*/javafx.controls.jmod \*/javafx.fxml.jmod \*/javafx.graphics.jmod -d openjfx-jmods
  50. - name: Ensure major jfx version in pom and in jmods is the same
  51. run: |
  52. JMOD_VERSION=$(jmod describe openjfx-jmods/javafx.base.jmod | head -1)
  53. JMOD_VERSION=${JMOD_VERSION#*@}
  54. JMOD_VERSION=${JMOD_VERSION%%.*}
  55. POM_JFX_VERSION=$(mvn help:evaluate "-Dexpression=javafx.version" -q -DforceStdout)
  56. POM_JFX_VERSION=${POM_JFX_VERSION#*@}
  57. POM_JFX_VERSION=${POM_JFX_VERSION%%.*}
  58. if [ $POM_JFX_VERSION -ne $JMOD_VERSION_AMD64 ]; then
  59. >&2 echo "Major JavaFX version in pom.xml (${POM_JFX_VERSION}) != amd64 jmod version (${JMOD_VERSION})"
  60. exit 1
  61. fi
  62. - name: Set version
  63. run : mvn versions:set -DnewVersion=${{ needs.get-version.outputs.semVerStr }}
  64. - name: Run maven
  65. run: mvn -B clean package -Pdependency-check,linux -DskipTests
  66. - name: Patch target dir
  67. run: |
  68. cp LICENSE.txt target
  69. cp target/cryptomator-*.jar target/mods
  70. - name: Run jlink
  71. run: >
  72. ${JAVA_HOME}/bin/jlink
  73. --verbose
  74. --output runtime
  75. --module-path "${JAVA_HOME}/jmods:openjfx-jmods"
  76. --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.crypto.ec,jdk.security.auth,jdk.accessibility,jdk.management.jfr,jdk.net
  77. --strip-native-commands
  78. --no-header-files
  79. --no-man-pages
  80. --strip-debug
  81. --compress=1
  82. - name: Prepare additional launcher
  83. run: envsubst '${SEMVER_STR} ${REVISION_NUM}' < dist/linux/launcher-gtk2.properties > launcher-gtk2.properties
  84. env:
  85. SEMVER_STR: ${{ needs.get-version.outputs.semVerStr }}
  86. REVISION_NUM: ${{ needs.get-version.outputs.revNum }}
  87. - name: Run jpackage
  88. run: >
  89. ${JAVA_HOME}/bin/jpackage
  90. --verbose
  91. --type app-image
  92. --runtime-image runtime
  93. --input target/libs
  94. --module-path target/mods
  95. --module org.cryptomator.desktop/org.cryptomator.launcher.Cryptomator
  96. --dest appdir
  97. --name Cryptomator
  98. --vendor "Skymatic GmbH"
  99. --copyright "(C) 2016 - 2023 Skymatic GmbH"
  100. --app-version "${{ needs.get-version.outputs.semVerNum }}.${{ needs.get-version.outputs.revNum }}"
  101. --java-options "--enable-preview"
  102. --java-options "--enable-native-access=org.cryptomator.jfuse.linux.amd64,org.cryptomator.jfuse.linux.aarch64,org.purejava.appindicator"
  103. --java-options "-Xss5m"
  104. --java-options "-Xmx256m"
  105. --java-options "-Dcryptomator.appVersion=\"${{ needs.get-version.outputs.semVerStr }}\""
  106. --java-options "-Dfile.encoding=\"utf-8\""
  107. --java-options "-Djava.net.useSystemProxies=true"
  108. --java-options "-Dcryptomator.logDir=\"@{userhome}/.local/share/Cryptomator/logs\""
  109. --java-options "-Dcryptomator.pluginDir=\"@{userhome}/.local/share/Cryptomator/plugins\""
  110. --java-options "-Dcryptomator.settingsPath=\"@{userhome}/.config/Cryptomator/settings.json:@{userhome}/.Cryptomator/settings.json\""
  111. --java-options "-Dcryptomator.p12Path=\"@{userhome}/.config/Cryptomator/key.p12\""
  112. --java-options "-Dcryptomator.ipcSocketPath=\"@{userhome}/.config/Cryptomator/ipc.socket\""
  113. --java-options "-Dcryptomator.mountPointsDir=\"@{userhome}/.local/share/Cryptomator/mnt\""
  114. --java-options "-Dcryptomator.showTrayIcon=true"
  115. --java-options "-Dcryptomator.integrationsLinux.trayIconsDir=\"@{appdir}/usr/share/icons/hicolor/symbolic/apps\""
  116. --java-options "-Dcryptomator.buildNumber=\"appimage-${{ needs.get-version.outputs.revNum }}\""
  117. --add-launcher Cryptomator-gtk2=launcher-gtk2.properties
  118. --resource-dir dist/linux/resources
  119. - name: Patch Cryptomator.AppDir
  120. run: |
  121. mv appdir/Cryptomator Cryptomator.AppDir
  122. cp -r dist/linux/appimage/resources/AppDir/* Cryptomator.AppDir/
  123. cp dist/linux/common/org.cryptomator.Cryptomator256.png Cryptomator.AppDir/usr/share/icons/hicolor/256x256/apps/org.cryptomator.Cryptomator.png
  124. cp dist/linux/common/org.cryptomator.Cryptomator512.png Cryptomator.AppDir/usr/share/icons/hicolor/512x512/apps/org.cryptomator.Cryptomator.png
  125. cp dist/linux/common/org.cryptomator.Cryptomator.svg Cryptomator.AppDir/usr/share/icons/hicolor/scalable/apps/org.cryptomator.Cryptomator.svg
  126. cp dist/linux/common/org.cryptomator.Cryptomator.tray.svg Cryptomator.AppDir/usr/share/icons/hicolor/scalable/apps/org.cryptomator.Cryptomator.tray.svg
  127. cp dist/linux/common/org.cryptomator.Cryptomator.tray-unlocked.svg Cryptomator.AppDir/usr/share/icons/hicolor/scalable/apps/org.cryptomator.Cryptomator.tray-unlocked.svg
  128. cp dist/linux/common/org.cryptomator.Cryptomator.tray.svg Cryptomator.AppDir/usr/share/icons/hicolor/symbolic/apps/org.cryptomator.Cryptomator.tray-symbolic.svg
  129. cp dist/linux/common/org.cryptomator.Cryptomator.tray-unlocked.svg Cryptomator.AppDir/usr/share/icons/hicolor/symbolic/apps/org.cryptomator.Cryptomator.tray-unlocked-symbolic.svg
  130. cp dist/linux/common/org.cryptomator.Cryptomator.metainfo.xml Cryptomator.AppDir/usr/share/metainfo/org.cryptomator.Cryptomator.metainfo.xml
  131. cp dist/linux/common/org.cryptomator.Cryptomator.desktop Cryptomator.AppDir/usr/share/applications/org.cryptomator.Cryptomator.desktop
  132. cp dist/linux/common/application-vnd.cryptomator.vault.xml Cryptomator.AppDir/usr/share/mime/packages/application-vnd.cryptomator.vault.xml
  133. ln -s usr/share/icons/hicolor/scalable/apps/org.cryptomator.Cryptomator.svg Cryptomator.AppDir/org.cryptomator.Cryptomator.svg
  134. ln -s usr/share/icons/hicolor/scalable/apps/org.cryptomator.Cryptomator.svg Cryptomator.AppDir/Cryptomator.svg
  135. ln -s usr/share/icons/hicolor/scalable/apps/org.cryptomator.Cryptomator.svg Cryptomator.AppDir/.DirIcon
  136. ln -s usr/share/applications/org.cryptomator.Cryptomator.desktop Cryptomator.AppDir/Cryptomator.desktop
  137. ln -s bin/cryptomator.sh Cryptomator.AppDir/AppRun
  138. - name: Download AppImageKit
  139. run: |
  140. curl -L https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-${{ matrix.appimage-suffix }}.AppImage -o appimagetool.AppImage
  141. chmod +x appimagetool.AppImage
  142. ./appimagetool.AppImage --appimage-extract
  143. - name: Prepare GPG-Agent for signing with key 615D449FE6E6A235
  144. run: |
  145. echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import
  146. echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --dry-run --sign README.md
  147. env:
  148. GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
  149. GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
  150. - name: Build AppImage
  151. run: >
  152. ./squashfs-root/AppRun Cryptomator.AppDir cryptomator-${{ needs.get-version.outputs.semVerStr }}-${{ matrix.appimage-suffix }}.AppImage
  153. -u 'gh-releases-zsync|cryptomator|cryptomator|latest|cryptomator-*-${{ matrix.appimage-suffix }}.AppImage.zsync'
  154. --sign --sign-key=615D449FE6E6A235 --sign-args="--batch --pinentry-mode loopback"
  155. - name: Create detached GPG signatures
  156. run: |
  157. gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a cryptomator-*.AppImage
  158. gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a cryptomator-*.AppImage.zsync
  159. - name: Upload artifacts
  160. uses: actions/upload-artifact@v3
  161. with:
  162. name: appimage-${{ matrix.appimage-suffix }}
  163. path: |
  164. cryptomator-*.AppImage
  165. cryptomator-*.AppImage.zsync
  166. cryptomator-*.asc
  167. if-no-files-found: error
  168. - name: Publish AppImage on GitHub Releases
  169. if: startsWith(github.ref, 'refs/tags/')
  170. uses: softprops/action-gh-release@v1
  171. with:
  172. fail_on_unmatched_files: true
  173. token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
  174. files: |
  175. cryptomator-*.AppImage
  176. cryptomator-*.zsync
  177. cryptomator-*.asc