win-exe.yml 14 KB

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