appimage.yml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. name: Build AppImage
  2. on:
  3. release:
  4. types: [published]
  5. workflow_dispatch:
  6. env:
  7. JAVA_VERSION: 17
  8. jobs:
  9. build:
  10. name: Build AppImage
  11. runs-on: ubuntu-latest
  12. steps:
  13. - uses: actions/checkout@v2
  14. with:
  15. fetch-depth: 0
  16. - name: Setup Java
  17. uses: actions/setup-java@v2
  18. with:
  19. distribution: 'temurin'
  20. java-version: ${{ env.JAVA_VERSION }}
  21. cache: 'maven'
  22. - id: versions
  23. name: Apply version information
  24. run: |
  25. if [[ $GITHUB_REF =~ refs/tags/[0-9]+\.[0-9]+\.[0-9]+.* ]]; then
  26. SEM_VER_STR=${GITHUB_REF##*/}
  27. mvn versions:set -DnewVersion=${SEM_VER_STR}
  28. else
  29. SEM_VER_STR=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout`
  30. fi
  31. SEM_VER_NUM=`echo ${SEM_VER_STR} | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+).*/\1/'`
  32. REVCOUNT=`git rev-list --count HEAD`
  33. echo "::set-output name=semVerStr::${SEM_VER_STR}"
  34. echo "::set-output name=semVerNum::${SEM_VER_NUM}"
  35. echo "::set-output name=revNum::${REVCOUNT}"
  36. - name: Validate Version
  37. uses: skymatic/semver-validation-action@v1
  38. with:
  39. version: ${{ steps.versions.outputs.semVerStr }}
  40. - name: Run maven
  41. run: mvn -B clean package -Pdependency-check,linux -DskipTests
  42. - name: Patch target dir
  43. run: |
  44. cp LICENSE.txt target
  45. cp dist/linux/launcher.sh target
  46. cp target/cryptomator-*.jar target/mods
  47. - name: Run jlink
  48. run: >
  49. ${JAVA_HOME}/bin/jlink
  50. --verbose
  51. --output runtime
  52. --module-path "${JAVA_HOME}/jmods"
  53. --add-modules java.base,java.desktop,java.logging,java.naming,java.net.http,java.scripting,java.sql,java.xml,jdk.unsupported,jdk.crypto.ec,jdk.accessibility,jdk.management.jfr
  54. --no-header-files
  55. --no-man-pages
  56. --strip-debug
  57. --compress=1
  58. - name: Run jpackage
  59. run: >
  60. envsubst '${SEMVER_STR} ${REVISION_NUM}' < dist/linux/launcher-gtk2.properties > launcher-gtk2.properties
  61. ${JAVA_HOME}/bin/jpackage
  62. --verbose
  63. --type app-image
  64. --runtime-image runtime
  65. --input target/libs
  66. --module-path target/mods
  67. --module org.cryptomator.desktop/org.cryptomator.launcher.Cryptomator
  68. --dest appdir
  69. --name Cryptomator
  70. --vendor "Skymatic GmbH"
  71. --copyright "(C) 2016 - 2022 Skymatic GmbH"
  72. --app-version "${{ steps.versions.outputs.semVerNum }}.${{ steps.versions.outputs.revNum }}"
  73. --java-options "-Xss5m"
  74. --java-options "-Xmx256m"
  75. --java-options "-Dcryptomator.appVersion=\"${{ steps.versions.outputs.semVerStr }}\""
  76. --java-options "-Dfile.encoding=\"utf-8\""
  77. --java-options "-Dcryptomator.logDir=\"~/.local/share/Cryptomator/logs\""
  78. --java-options "-Dcryptomator.pluginDir=\"~/.local/share/Cryptomator/plugins\""
  79. --java-options "-Dcryptomator.settingsPath=\"~/.config/Cryptomator/settings.json:~/.Cryptomator/settings.json\""
  80. --java-options "-Dcryptomator.ipcSocketPath=\"~/.config/Cryptomator/ipc.socket\""
  81. --java-options "-Dcryptomator.mountPointsDir=\"~/.local/share/Cryptomator/mnt\""
  82. --java-options "-Dcryptomator.showTrayIcon=false"
  83. --java-options "-Dcryptomator.buildNumber=\"appimage-${{ steps.versions.outputs.revNum }}\""
  84. --add-launcher Cryptomator-gtk2=launcher-gtk2.properties \
  85. --resource-dir dist/linux/resources
  86. - name: Patch Cryptomator.AppDir
  87. run: |
  88. mv appdir/Cryptomator Cryptomator.AppDir
  89. cp -r dist/linux/appimage/resources/AppDir/* Cryptomator.AppDir/
  90. envsubst '${REVISION_NO} ${SEMVER_STR}' < dist/linux/appimage/resources/AppDir/bin/cryptomator.sh > Cryptomator.AppDir/bin/cryptomator.sh
  91. cp dist/linux/common/org.cryptomator.Cryptomator256.png Cryptomator.AppDir/usr/share/icons/hicolor/256x256/apps/org.cryptomator.Cryptomator.png
  92. cp dist/linux/common/org.cryptomator.Cryptomator512.png Cryptomator.AppDir/usr/share/icons/hicolor/512x512/apps/org.cryptomator.Cryptomator.png
  93. cp dist/linux/common/org.cryptomator.Cryptomator.svg Cryptomator.AppDir/usr/share/icons/hicolor/scalable/apps/org.cryptomator.Cryptomator.svg
  94. cp dist/linux/common/org.cryptomator.Cryptomator.metainfo.xml Cryptomator.AppDir/usr/share/metainfo/org.cryptomator.Cryptomator.metainfo.xml
  95. cp dist/linux/common/org.cryptomator.Cryptomator.desktop Cryptomator.AppDir/usr/share/applications/org.cryptomator.Cryptomator.desktop
  96. cp dist/linux/common/application-vnd.cryptomator.vault.xml Cryptomator.AppDir/usr/share/mime/packages/application-vnd.cryptomator.vault.xml
  97. ln -s usr/share/icons/hicolor/scalable/apps/org.cryptomator.Cryptomator.svg Cryptomator.AppDir/org.cryptomator.Cryptomator.svg
  98. ln -s usr/share/icons/hicolor/scalable/apps/org.cryptomator.Cryptomator.svg Cryptomator.AppDir/Cryptomator.svg
  99. ln -s usr/share/icons/hicolor/scalable/apps/org.cryptomator.Cryptomator.svg Cryptomator.AppDir/.DirIcon
  100. ln -s usr/share/applications/org.cryptomator.Cryptomator.desktop Cryptomator.AppDir/Cryptomator.desktop
  101. ln -s bin/cryptomator.sh Cryptomator.AppDir/AppRun
  102. env:
  103. REVISION_NO: ${{ steps.versions.outputs.revNum }}
  104. SEMVER_STR: ${{ steps.versions.outputs.semVerStr }}
  105. - name: Extract libjffi.so # workaround for https://github.com/cryptomator/cryptomator-linux/issues/27
  106. run: |
  107. JFFI_NATIVE_JAR=`ls lib/app/ | grep -e 'jffi-[1-9]\.[0-9]\{1,2\}.[0-9]\{1,2\}-native.jar'`
  108. ${JAVA_HOME}/bin/jar -xf lib/app/${JFFI_NATIVE_JAR} /jni/x86_64-Linux/
  109. mv jni/x86_64-Linux/* lib/app/libjffi.so
  110. working-directory: Cryptomator.AppDir
  111. - name: Download AppImageKit
  112. run: |
  113. curl -L https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage -o appimagetool.AppImage
  114. chmod +x appimagetool.AppImage
  115. ./appimagetool.AppImage --appimage-extract
  116. - name: Prepare GPG-Agent for signing with key 615D449FE6E6A235
  117. run: |
  118. echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import
  119. echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --dry-run --sign README.md
  120. env:
  121. GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
  122. GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
  123. - name: Build AppImage
  124. run: >
  125. ./squashfs-root/AppRun Cryptomator.AppDir cryptomator-${{ steps.versions.outputs.semVerStr }}-x86_64.AppImage
  126. -u 'gh-releases-zsync|cryptomator|cryptomator|latest|cryptomator-*-x86_64.AppImage.zsync'
  127. --sign --sign-key=615D449FE6E6A235 --sign-args="--batch --pinentry-mode loopback"
  128. - name: Create detached GPG signatures
  129. run: |
  130. gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a cryptomator-*.AppImage
  131. gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a cryptomator-*.AppImage.zsync
  132. - name: Upload artifacts
  133. uses: actions/upload-artifact@v3
  134. with:
  135. name: appimage
  136. path: |
  137. cryptomator-*.AppImage
  138. cryptomator-*.AppImage.zsync
  139. cryptomator-*.asc
  140. if-no-files-found: error
  141. - name: Publish AppImage on GitHub Releases
  142. if: startsWith(github.ref, 'refs/tags/')
  143. uses: softprops/action-gh-release@v1
  144. with:
  145. fail_on_unmatched_files: true
  146. token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
  147. files: |
  148. *.AppImage
  149. *.zsync
  150. *.asc