win-exe.yml 14 KB

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