appimage.yml 7.3 KB

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