win-exe.yml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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.instrument,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.p12Path=\"~/AppData/Roaming/Cryptomator/key.p12\""
  92. --java-options "-Dcryptomator.ipcSocketPath=\"~/AppData/Roaming/Cryptomator/ipc.socket\""
  93. --java-options "-Dcryptomator.keychainPath=\"~/AppData/Roaming/Cryptomator/keychain.json\""
  94. --java-options "-Dcryptomator.mountPointsDir=\"~/Cryptomator\""
  95. --java-options "-Dcryptomator.showTrayIcon=true"
  96. --java-options "-Dcryptomator.buildNumber=\"msi-${{ steps.versions.outputs.revNum }}\""
  97. --java-options "-Dcryptomator.integrationsWin.autoStartShellLinkName=\"Cryptomator\""
  98. --resource-dir dist/win/resources
  99. --icon dist/win/resources/Cryptomator.ico
  100. - name: Patch Application Directory
  101. run: |
  102. cp dist/win/contrib/* appdir/Cryptomator
  103. - name: Fix permissions
  104. run: attrib -r appdir/Cryptomator/Cryptomator.exe
  105. shell: pwsh
  106. - name: Codesign
  107. uses: skymatic/code-sign-action@v1
  108. with:
  109. certificate: ${{ secrets.WIN_CODESIGN_P12_BASE64 }}
  110. password: ${{ secrets.WIN_CODESIGN_P12_PW }}
  111. certificatesha1: FF52240075AD7D14AF25629FDF69635357C7D14B
  112. description: Cryptomator
  113. timestampUrl: 'http://timestamp.digicert.com'
  114. folder: appdir/Cryptomator
  115. recursive: true
  116. - name: Generate license for MSI
  117. run: >
  118. mvn -B license:add-third-party
  119. "-Dlicense.thirdPartyFilename=license.rtf"
  120. "-Dlicense.outputDirectory=dist/win/resources"
  121. "-Dlicense.fileTemplate=dist/win/resources/licenseTemplate.ftl"
  122. "-Dlicense.includedScopes=compile"
  123. "-Dlicense.excludedGroups=^org\.cryptomator"
  124. "-Dlicense.failOnMissing=true"
  125. "-Dlicense.licenseMergesUrl=file:///${{ github.workspace }}/license/merges"
  126. shell: pwsh
  127. - name: Create MSI
  128. run: >
  129. ${JAVA_HOME}/bin/jpackage
  130. --verbose
  131. --type msi
  132. --win-upgrade-uuid bda45523-42b1-4cae-9354-a45475ed4775
  133. --app-image appdir/Cryptomator
  134. --dest installer
  135. --name Cryptomator
  136. --vendor "Skymatic GmbH"
  137. --copyright "(C) 2016 - 2022 Skymatic GmbH"
  138. --app-version "${{ steps.versions.outputs.semVerNum }}"
  139. --win-menu
  140. --win-dir-chooser
  141. --win-shortcut-prompt
  142. --win-update-url "https:\\cryptomator.org"
  143. --win-menu-group Cryptomator
  144. --resource-dir dist/win/resources
  145. --license-file dist/win/resources/license.rtf
  146. --file-associations dist/win/resources/FAvaultFile.properties
  147. env:
  148. JP_WIXWIZARD_RESOURCES: ${{ github.workspace }}/dist/win/resources # requires abs path, used in resources/main.wxs
  149. - name: Codesign MSI
  150. uses: skymatic/code-sign-action@v1
  151. with:
  152. certificate: ${{ secrets.WIN_CODESIGN_P12_BASE64 }}
  153. password: ${{ secrets.WIN_CODESIGN_P12_PW }}
  154. certificatesha1: FF52240075AD7D14AF25629FDF69635357C7D14B
  155. description: Cryptomator Installer
  156. timestampUrl: 'http://timestamp.digicert.com'
  157. folder: installer
  158. - name: Add possible alpha/beta tags to installer name
  159. run: mv installer/Cryptomator-*.msi Cryptomator-${{ steps.versions.outputs.semVerStr }}-x64.msi
  160. - name: Create detached GPG signature with key 615D449FE6E6A235
  161. run: |
  162. echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import
  163. echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a Cryptomator-*.msi
  164. env:
  165. GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
  166. GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
  167. - name: Upload artifacts
  168. uses: actions/upload-artifact@v3
  169. with:
  170. name: msi
  171. path: |
  172. Cryptomator-*.msi
  173. Cryptomator-*.asc
  174. if-no-files-found: error
  175. - name: Publish .msi on GitHub Releases
  176. if: startsWith(github.ref, 'refs/tags/')
  177. uses: softprops/action-gh-release@v1
  178. with:
  179. fail_on_unmatched_files: true
  180. token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
  181. files: |
  182. *.msi
  183. *.asc
  184. outputs:
  185. semVerNum: ${{ steps.versions.outputs.semVerNum }}
  186. semVerStr: ${{ steps.versions.outputs.semVerStr }}
  187. revNum: ${{ steps.versions.outputs.revNum }}
  188. publish-winget:
  189. name: Publish on winget repo
  190. runs-on: windows-latest
  191. needs: [build-msi]
  192. steps:
  193. - name: Submit package to Windows Package Manager Community Repository
  194. run: |
  195. iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
  196. $github = Get-Content '${{ github.event_path }}' | ConvertFrom-Json
  197. $installerUrl = $github.release.assets | Where-Object -Property name -match 'Cryptomator-*.msi' | Select -ExpandProperty browser_download_url -First 1
  198. .\wingetcreate.exe update Cryptomator.Cryptomator -s -v $github.release.tag_name -u $installerUrl -t ${{ secrets.CRYPTOBOT_WINGET_TOKEN }}
  199. shell: pwsh
  200. build-exe:
  201. name: Build .exe installer
  202. runs-on: windows-latest
  203. needs: [build-msi]
  204. steps:
  205. - uses: actions/checkout@v2
  206. - name: Download .msi
  207. uses: actions/download-artifact@v2
  208. with:
  209. name: msi
  210. path: dist/win/bundle/resources
  211. - name: Strip version info from msi file name
  212. run: mv dist/win/bundle/resources/Cryptomator*.msi dist/win/bundle/resources/Cryptomator.msi
  213. - uses: actions/setup-java@v2
  214. with:
  215. distribution: 'temurin'
  216. java-version: ${{ env.JAVA_VERSION }}
  217. cache: 'maven'
  218. - name: Generate license for exe
  219. run: >
  220. mvn -B license:add-third-party
  221. "-Dlicense.thirdPartyFilename=license.rtf"
  222. "-Dlicense.fileTemplate=dist/win/bundle/resources/licenseTemplate.ftl"
  223. "-Dlicense.outputDirectory=dist/win/bundle/resources"
  224. "-Dlicense.includedScopes=compile"
  225. "-Dlicense.excludedGroups=^org\.cryptomator"
  226. "-Dlicense.failOnMissing=true"
  227. "-Dlicense.licenseMergesUrl=file:///${{ github.workspace }}/license/merges"
  228. shell: pwsh
  229. - name: Download WinFsp
  230. run:
  231. curl --output dist/win/bundle/resources/winfsp.msi -L ${{ env.WINFSP_MSI }}
  232. - name: Compile to wixObj file
  233. run: >
  234. "${WIX}/bin/candle.exe" dist/win/bundle/bundleWithWinfsp.wxs
  235. -ext WixBalExtension
  236. -out dist/win/bundle/
  237. -dBundleVersion="${{ needs.build-msi.outputs.semVerNum }}.${{ needs.build-msi.outputs.revNum }}"
  238. -dBundleVendor="Skymatic GmbH"
  239. -dBundleCopyright="(C) 2016 - 2022 Skymatic GmbH"
  240. -dAboutUrl="https://cryptomator.org"
  241. -dHelpUrl="https://cryptomator.org/contact"
  242. -dUpdateUrl="https://cryptomator.org/downloads/"
  243. - name: Create executable with linker
  244. run: >
  245. "${WIX}/bin/light.exe" -b dist/win/ dist/win/bundle/bundleWithWinfsp.wixobj
  246. -ext WixBalExtension
  247. -out installer/unsigned/Cryptomator-Installer.exe
  248. - name: Detach burn engine in preparation to sign
  249. run: >
  250. "${WIX}/bin/insignia.exe"
  251. -ib installer/unsigned/Cryptomator-Installer.exe
  252. -o tmp/engine.exe
  253. - name: Codesign burn engine
  254. uses: skymatic/code-sign-action@v1
  255. with:
  256. certificate: ${{ secrets.WIN_CODESIGN_P12_BASE64 }}
  257. password: ${{ secrets.WIN_CODESIGN_P12_PW }}
  258. certificatesha1: FF52240075AD7D14AF25629FDF69635357C7D14B
  259. description: Cryptomator Installer
  260. timestampUrl: 'http://timestamp.digicert.com'
  261. folder: tmp
  262. - name: Reattach signed burn engine to installer
  263. run : >
  264. "${WIX}/bin/insignia.exe"
  265. -ab tmp/engine.exe installer/unsigned/Cryptomator-Installer.exe
  266. -o installer/Cryptomator-Installer.exe
  267. - name: Codesign EXE
  268. uses: skymatic/code-sign-action@v1
  269. with:
  270. certificate: ${{ secrets.WIN_CODESIGN_P12_BASE64 }}
  271. password: ${{ secrets.WIN_CODESIGN_P12_PW }}
  272. certificatesha1: FF52240075AD7D14AF25629FDF69635357C7D14B
  273. description: Cryptomator Installer
  274. timestampUrl: 'http://timestamp.digicert.com'
  275. folder: installer
  276. - name: Add possible alpha/beta tags to installer name
  277. run: mv installer/Cryptomator-Installer.exe Cryptomator-${{ needs.build-msi.outputs.semVerStr }}-x64.exe
  278. - name: Create detached GPG signature with key 615D449FE6E6A235
  279. run: |
  280. echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import
  281. echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a Cryptomator-*.exe
  282. env:
  283. GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
  284. GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
  285. - name: Upload artifacts
  286. uses: actions/upload-artifact@v3
  287. with:
  288. name: exe
  289. path: |
  290. Cryptomator-*.exe
  291. Cryptomator-*.asc
  292. if-no-files-found: error
  293. - name: Publish .msi on GitHub Releases
  294. if: startsWith(github.ref, 'refs/tags/')
  295. uses: softprops/action-gh-release@v1
  296. with:
  297. fail_on_unmatched_files: true
  298. token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
  299. files: |
  300. Cryptomator-*.exe
  301. Cryptomator-*.asc
  302. allowlist:
  303. name: Anti Virus Allowlisting
  304. if: startsWith(github.ref, 'refs/tags/')
  305. runs-on: ubuntu-latest
  306. needs: [build-msi, build-exe]
  307. steps:
  308. - name: Download .msi
  309. uses: actions/download-artifact@v2
  310. with:
  311. name: msi
  312. path: msi
  313. - name: Download .exe
  314. uses: actions/download-artifact@v2
  315. with:
  316. name: exe
  317. path: exe
  318. - name: Collect files
  319. run: |
  320. mkdir files
  321. cp msi/*.msi files
  322. cp exe/*.exe files
  323. - name: Upload to Kaspersky
  324. uses: SamKirkland/FTP-Deploy-Action@4.3.0
  325. with:
  326. protocol: ftps
  327. server: allowlist.kaspersky-labs.com
  328. port: 990
  329. username: ${{ secrets.ALLOWLIST_KASPERSKY_USERNAME }}
  330. password: ${{ secrets.ALLOWLIST_KASPERSKY_PASSWORD }}
  331. local-dir: files/
  332. - name: Upload to Avast
  333. uses: SamKirkland/FTP-Deploy-Action@4.3.0
  334. with:
  335. protocol: ftp
  336. server: whitelisting.avast.com
  337. port: 21
  338. username: ${{ secrets.ALLOWLIST_AVAST_USERNAME }}
  339. password: ${{ secrets.ALLOWLIST_AVAST_PASSWORD }}
  340. local-dir: files/