win-exe.yml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. name: Build Windows Installer
  2. on:
  3. release:
  4. types: [published]
  5. workflow_dispatch:
  6. inputs:
  7. version:
  8. description: 'Version'
  9. required: false
  10. env:
  11. JAVA_VERSION: 17
  12. WINFSP_MSI: https://github.com/winfsp/winfsp/releases/download/v1.10/winfsp-1.10.22006.msi
  13. defaults:
  14. run:
  15. shell: bash
  16. jobs:
  17. build-msi:
  18. name: Build .msi Installer
  19. runs-on: windows-latest
  20. steps:
  21. - uses: actions/checkout@v2
  22. with:
  23. fetch-depth: 0
  24. - name: Setup Java
  25. uses: actions/setup-java@v2
  26. with:
  27. distribution: 'temurin'
  28. java-version: ${{ env.JAVA_VERSION }}
  29. cache: 'maven'
  30. - id: versions
  31. name: Apply version information
  32. run: |
  33. if [[ $GITHUB_REF =~ refs/tags/[0-9]+\.[0-9]+\.[0-9]+.* ]]; then
  34. SEM_VER_STR=${GITHUB_REF##*/}
  35. mvn versions:set -DnewVersion=${SEM_VER_STR}
  36. elif [[ "${{ github.event.inputs.version }}" =~ [0-9]+\.[0-9]+\.[0-9]+.* ]]; then
  37. SEM_VER_STR="${{ github.event.inputs.version }}"
  38. mvn versions:set -DnewVersion=${SEM_VER_STR}
  39. else
  40. SEM_VER_STR=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout`
  41. fi
  42. SEM_VER_NUM=`echo ${SEM_VER_STR} | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+).*/\1/'`
  43. REVCOUNT=`git rev-list --count HEAD`
  44. echo "::set-output name=semVerStr::${SEM_VER_STR}"
  45. echo "::set-output name=semVerNum::${SEM_VER_NUM}"
  46. echo "::set-output name=revNum::${REVCOUNT}"
  47. - name: Validate Version
  48. uses: skymatic/semver-validation-action@v1
  49. with:
  50. version: ${{ steps.versions.outputs.semVerStr }}
  51. - name: Run maven
  52. run: mvn -B clean package -Pdependency-check,win -DskipTests
  53. - name: Patch target dir
  54. run: |
  55. cp LICENSE.txt target
  56. cp dist/linux/launcher.sh target
  57. cp target/cryptomator-*.jar target/mods
  58. - name: Run jlink
  59. run: >
  60. ${JAVA_HOME}/bin/jlink
  61. --verbose
  62. --output runtime
  63. --module-path "${JAVA_HOME}/jmods"
  64. --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
  65. --strip-native-commands
  66. --no-header-files
  67. --no-man-pages
  68. --strip-debug
  69. --compress=1
  70. - name: Run jpackage
  71. run: >
  72. ${JAVA_HOME}/bin/jpackage
  73. --verbose
  74. --type app-image
  75. --runtime-image runtime
  76. --input target/libs
  77. --module-path target/mods
  78. --module org.cryptomator.desktop/org.cryptomator.launcher.Cryptomator
  79. --dest appdir
  80. --name Cryptomator
  81. --vendor "Skymatic GmbH"
  82. --copyright "(C) 2016 - 2022 Skymatic GmbH"
  83. --app-version "${{ steps.versions.outputs.semVerNum }}.${{ steps.versions.outputs.revNum }}"
  84. --java-options "-Xss5m"
  85. --java-options "-Xmx256m"
  86. --java-options "-Dcryptomator.appVersion=\"${{ steps.versions.outputs.semVerStr }}\""
  87. --java-options "-Dfile.encoding=\"utf-8\""
  88. --java-options "-Dcryptomator.logDir=\"~/AppData/Roaming/Cryptomator\""
  89. --java-options "-Dcryptomator.pluginDir=\"~/AppData/Roaming/Cryptomator/Plugins\""
  90. --java-options "-Dcryptomator.settingsPath=\"~/AppData/Roaming/Cryptomator/settings.json\""
  91. --java-options "-Dcryptomator.ipcSocketPath=\"~/AppData/Roaming/Cryptomator/ipc.socket\""
  92. --java-options "-Dcryptomator.keychainPath=\"~/AppData/Roaming/Cryptomator/keychain.json\""
  93. --java-options "-Dcryptomator.mountPointsDir=\"~/Cryptomator\""
  94. --java-options "-Dcryptomator.showTrayIcon=true"
  95. --java-options "-Dcryptomator.buildNumber=\"msi-${{ steps.versions.outputs.revNum }}\""
  96. --resource-dir dist/win/resources
  97. --icon dist/win/resources/Cryptomator.ico
  98. - name: Patch Application Directory
  99. run: |
  100. cp dist/win/contrib/* appdir/Cryptomator
  101. - name: Fix permissions
  102. run: attrib -r appdir/Cryptomator/Cryptomator.exe
  103. shell: pwsh
  104. - name: Codesign
  105. uses: skymatic/code-sign-action@v1
  106. with:
  107. certificate: ${{ secrets.WIN_CODESIGN_P12_BASE64 }}
  108. password: ${{ secrets.WIN_CODESIGN_P12_PW }}
  109. certificatesha1: FF52240075AD7D14AF25629FDF69635357C7D14B
  110. description: Cryptomator
  111. timestampUrl: 'http://timestamp.digicert.com'
  112. folder: appdir/Cryptomator
  113. recursive: true
  114. - name: Generate license
  115. run: >
  116. mvn -B license:add-third-party
  117. "-Dlicense.thirdPartyFilename=license.rtf"
  118. "-Dlicense.fileTemplate=dist/win/resources/licenseTemplate.ftl"
  119. "-Dlicense.outputDirectory=dist/win/resources"
  120. - name: Create MSI
  121. run: >
  122. ${JAVA_HOME}/bin/jpackage
  123. --verbose
  124. --type msi
  125. --win-upgrade-uuid bda45523-42b1-4cae-9354-a45475ed4775
  126. --app-image appdir/Cryptomator
  127. --dest installer
  128. --name Cryptomator
  129. --vendor "Skymatic GmbH"
  130. --copyright "(C) 2016 - 2022 Skymatic GmbH"
  131. --app-version "${{ steps.versions.outputs.semVerNum }}"
  132. --win-menu
  133. --win-dir-chooser
  134. --win-shortcut-prompt
  135. --win-update-url "https:\\cryptomator.org"
  136. --win-menu-group Cryptomator
  137. --resource-dir dist/win/resources
  138. --license-file dist/win/resources/license.rtf
  139. --file-associations dist/win/resources/FAvaultFile.properties
  140. env:
  141. JP_WIXWIZARD_RESOURCES: ${{ github.workspace }}/dist/win/resources # requires abs path, used in resources/main.wxs
  142. - name: Codesign MSI
  143. uses: skymatic/code-sign-action@v1
  144. with:
  145. certificate: ${{ secrets.WIN_CODESIGN_P12_BASE64 }}
  146. password: ${{ secrets.WIN_CODESIGN_P12_PW }}
  147. certificatesha1: FF52240075AD7D14AF25629FDF69635357C7D14B
  148. description: Cryptomator Installer
  149. timestampUrl: 'http://timestamp.digicert.com'
  150. folder: installer
  151. - name: Add possible alpha/beta tags to installer name
  152. run: mv installer/Cryptomator-*.msi Cryptomator-${{ steps.versions.outputs.semVerStr }}-x64.msi
  153. - name: Create detached GPG signature with key 615D449FE6E6A235
  154. run: |
  155. echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import
  156. echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a Cryptomator-*.msi
  157. env:
  158. GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
  159. GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
  160. - name: Upload artifacts
  161. uses: actions/upload-artifact@v3
  162. with:
  163. name: msi
  164. path: |
  165. Cryptomator-*.msi
  166. Cryptomator-*.asc
  167. if-no-files-found: error
  168. - name: Publish .msi 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. *.msi
  176. *.asc
  177. outputs:
  178. semVerNum: ${{ steps.versions.outputs.semVerNum }}
  179. semVerStr: ${{ steps.versions.outputs.semVerStr }}
  180. revNum: ${{ steps.versions.outputs.revNum }}
  181. build-exe:
  182. name: Build .exe installer
  183. runs-on: windows-latest
  184. needs: [build-msi]
  185. steps:
  186. - uses: actions/checkout@v2
  187. - name: Download .msi
  188. uses: actions/download-artifact@v2
  189. with:
  190. name: msi
  191. path: dist/win/bundle/resources
  192. - name: Strip version info from msi file name
  193. run: mv dist/win/bundle/resources/Cryptomator*.msi dist/win/bundle/resources/Cryptomator.msi
  194. - uses: actions/setup-java@v2
  195. with:
  196. distribution: 'temurin'
  197. java-version: ${{ env.JAVA_VERSION }}
  198. cache: 'maven'
  199. - name: Generate license
  200. run: >
  201. mvn -B license:add-third-party
  202. "-Dlicense.thirdPartyFilename=license.rtf"
  203. "-Dlicense.fileTemplate=dist/win/bundle/resources/licenseTemplate.ftl"
  204. "-Dlicense.outputDirectory=dist/win/bundle/resources"
  205. - name: Download WinFsp
  206. run:
  207. curl --output dist/win/bundle/resources/winfsp.msi -L ${{ env.WINFSP_MSI }}
  208. - name: Compile to wixObj file
  209. run: >
  210. "${WIX}/bin/candle.exe" dist/win/bundle/bundleWithWinfsp.wxs
  211. -ext WixBalExtension
  212. -out dist/win/bundle/
  213. -dBundleVersion="${{ needs.build-msi.outputs.semVerNum }}.${{ needs.build-msi.outputs.revNum }}"
  214. -dBundleVendor="Skymatic GmbH"
  215. -dBundleCopyright="(C) 2016 - 2022 Skymatic GmbH"
  216. -dAboutUrl="https://cryptomator.org"
  217. -dHelpUrl="https://cryptomator.org/contact"
  218. -dUpdateUrl="https://cryptomator.org/downloads/"
  219. - name: Create executable with linker
  220. run: >
  221. "${WIX}/bin/light.exe" -b dist/win/ dist/win/bundle/bundleWithWinfsp.wixobj
  222. -ext WixBalExtension
  223. -out installer/unsigned/Cryptomator-Installer.exe
  224. - name: Detach burn engine in preparation to sign
  225. run: >
  226. "${WIX}/bin/insignia.exe"
  227. -ib installer/unsigned/Cryptomator-Installer.exe
  228. -o tmp/engine.exe
  229. - name: Codesign burn engine
  230. uses: skymatic/code-sign-action@v1
  231. with:
  232. certificate: ${{ secrets.WIN_CODESIGN_P12_BASE64 }}
  233. password: ${{ secrets.WIN_CODESIGN_P12_PW }}
  234. certificatesha1: FF52240075AD7D14AF25629FDF69635357C7D14B
  235. description: Cryptomator Installer
  236. timestampUrl: 'http://timestamp.digicert.com'
  237. folder: tmp
  238. - name: Reattach signed burn engine to installer
  239. run : >
  240. "${WIX}/bin/insignia.exe"
  241. -ab tmp/engine.exe installer/unsigned/Cryptomator-Installer.exe
  242. -o installer/Cryptomator-Installer.exe
  243. - name: Codesign EXE
  244. uses: skymatic/code-sign-action@v1
  245. with:
  246. certificate: ${{ secrets.WIN_CODESIGN_P12_BASE64 }}
  247. password: ${{ secrets.WIN_CODESIGN_P12_PW }}
  248. certificatesha1: FF52240075AD7D14AF25629FDF69635357C7D14B
  249. description: Cryptomator Installer
  250. timestampUrl: 'http://timestamp.digicert.com'
  251. folder: installer
  252. - name: Add possible alpha/beta tags to installer name
  253. run: mv installer/Cryptomator-Installer.exe Cryptomator-${{ needs.build-msi.outputs.semVerStr }}-x64.exe
  254. - name: Create detached GPG signature with key 615D449FE6E6A235
  255. run: |
  256. echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import
  257. echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a Cryptomator-*.exe
  258. env:
  259. GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
  260. GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
  261. - name: Upload artifacts
  262. uses: actions/upload-artifact@v3
  263. with:
  264. name: exe
  265. path: |
  266. Cryptomator-*.exe
  267. Cryptomator-*.asc
  268. if-no-files-found: error
  269. - name: Publish .msi on GitHub Releases
  270. if: startsWith(github.ref, 'refs/tags/')
  271. uses: softprops/action-gh-release@v1
  272. with:
  273. fail_on_unmatched_files: true
  274. token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
  275. files: |
  276. Cryptomator-*.exe
  277. Cryptomator-*.asc
  278. allowlist:
  279. name: Anti Virus Allowlisting
  280. if: startsWith(github.ref, 'refs/tags/')
  281. runs-on: ubuntu-latest
  282. needs: [build-msi, build-exe]
  283. steps:
  284. - name: Download .msi
  285. uses: actions/download-artifact@v2
  286. with:
  287. name: msi
  288. path: msi
  289. - name: Download .exe
  290. uses: actions/download-artifact@v2
  291. with:
  292. name: exe
  293. path: exe
  294. - name: Collect files
  295. run: |
  296. mkdir files
  297. cp msi/*.msi files
  298. cp exe/*.exe files
  299. - name: Upload to Kaspersky
  300. uses: SamKirkland/FTP-Deploy-Action@4.3.0
  301. with:
  302. protocol: ftps
  303. server: allowlist.kaspersky-labs.com
  304. port: 990
  305. username: ${{ secrets.ALLOWLIST_KASPERSKY_USERNAME }}
  306. password: ${{ secrets.ALLOWLIST_KASPERSKY_PASSWORD }}
  307. local-dir: files/
  308. - name: Upload to Avast
  309. uses: SamKirkland/FTP-Deploy-Action@4.3.0
  310. with:
  311. protocol: ftp
  312. server: whitelisting.avast.com
  313. port: 21
  314. username: ${{ secrets.ALLOWLIST_AVAST_USERNAME }}
  315. password: ${{ secrets.ALLOWLIST_AVAST_PASSWORD }}
  316. local-dir: files/