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: 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. --java-options "-Dcryptomator.integrationsWin.autoStartShellLinkName=\"Cryptomator\""
  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: FF52240075AD7D14AF25629FDF69635357C7D14B
  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: FF52240075AD7D14AF25629FDF69635357C7D14B
  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. publish-winget:
  188. name: Publish on winget repo
  189. runs-on: windows-latest
  190. needs: [build-msi]
  191. steps:
  192. - name: Submit package to Windows Package Manager Community Repository
  193. run: |
  194. iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
  195. $github = Get-Content '${{ github.event_path }}' | ConvertFrom-Json
  196. $installerUrl = $github.release.assets | Where-Object -Property name -match 'Cryptomator-*.msi' | Select -ExpandProperty browser_download_url -First 1
  197. .\wingetcreate.exe update Cryptomator.Cryptomator -s -v $github.release.tag_name -u $installerUrl -t ${{ secrets.CRYPTOBOT_WINGET_TOKEN }}
  198. shell: pwsh
  199. build-exe:
  200. name: Build .exe installer
  201. runs-on: windows-latest
  202. needs: [build-msi]
  203. steps:
  204. - uses: actions/checkout@v2
  205. - name: Download .msi
  206. uses: actions/download-artifact@v2
  207. with:
  208. name: msi
  209. path: dist/win/bundle/resources
  210. - name: Strip version info from msi file name
  211. run: mv dist/win/bundle/resources/Cryptomator*.msi dist/win/bundle/resources/Cryptomator.msi
  212. - uses: actions/setup-java@v2
  213. with:
  214. distribution: 'temurin'
  215. java-version: ${{ env.JAVA_VERSION }}
  216. cache: 'maven'
  217. - name: Generate license for exe
  218. run: >
  219. mvn -B license:add-third-party
  220. "-Dlicense.thirdPartyFilename=license.rtf"
  221. "-Dlicense.fileTemplate=dist/win/bundle/resources/licenseTemplate.ftl"
  222. "-Dlicense.outputDirectory=dist/win/bundle/resources"
  223. "-Dlicense.includedScopes=compile"
  224. "-Dlicense.excludedGroups=^org\.cryptomator"
  225. "-Dlicense.failOnMissing=true"
  226. "-Dlicense.licenseMergesUrl=file:///${{ github.workspace }}/license/merges"
  227. shell: pwsh
  228. - name: Download WinFsp
  229. run:
  230. curl --output dist/win/bundle/resources/winfsp.msi -L ${{ env.WINFSP_MSI }}
  231. - name: Compile to wixObj file
  232. run: >
  233. "${WIX}/bin/candle.exe" dist/win/bundle/bundleWithWinfsp.wxs
  234. -ext WixBalExtension
  235. -out dist/win/bundle/
  236. -dBundleVersion="${{ needs.build-msi.outputs.semVerNum }}.${{ needs.build-msi.outputs.revNum }}"
  237. -dBundleVendor="Skymatic GmbH"
  238. -dBundleCopyright="(C) 2016 - 2022 Skymatic GmbH"
  239. -dAboutUrl="https://cryptomator.org"
  240. -dHelpUrl="https://cryptomator.org/contact"
  241. -dUpdateUrl="https://cryptomator.org/downloads/"
  242. - name: Create executable with linker
  243. run: >
  244. "${WIX}/bin/light.exe" -b dist/win/ dist/win/bundle/bundleWithWinfsp.wixobj
  245. -ext WixBalExtension
  246. -out installer/unsigned/Cryptomator-Installer.exe
  247. - name: Detach burn engine in preparation to sign
  248. run: >
  249. "${WIX}/bin/insignia.exe"
  250. -ib installer/unsigned/Cryptomator-Installer.exe
  251. -o tmp/engine.exe
  252. - name: Codesign burn engine
  253. uses: skymatic/code-sign-action@v1
  254. with:
  255. certificate: ${{ secrets.WIN_CODESIGN_P12_BASE64 }}
  256. password: ${{ secrets.WIN_CODESIGN_P12_PW }}
  257. certificatesha1: FF52240075AD7D14AF25629FDF69635357C7D14B
  258. description: Cryptomator Installer
  259. timestampUrl: 'http://timestamp.digicert.com'
  260. folder: tmp
  261. - name: Reattach signed burn engine to installer
  262. run : >
  263. "${WIX}/bin/insignia.exe"
  264. -ab tmp/engine.exe installer/unsigned/Cryptomator-Installer.exe
  265. -o installer/Cryptomator-Installer.exe
  266. - name: Codesign EXE
  267. uses: skymatic/code-sign-action@v1
  268. with:
  269. certificate: ${{ secrets.WIN_CODESIGN_P12_BASE64 }}
  270. password: ${{ secrets.WIN_CODESIGN_P12_PW }}
  271. certificatesha1: FF52240075AD7D14AF25629FDF69635357C7D14B
  272. description: Cryptomator Installer
  273. timestampUrl: 'http://timestamp.digicert.com'
  274. folder: installer
  275. - name: Add possible alpha/beta tags to installer name
  276. run: mv installer/Cryptomator-Installer.exe Cryptomator-${{ needs.build-msi.outputs.semVerStr }}-x64.exe
  277. - name: Create detached GPG signature with key 615D449FE6E6A235
  278. run: |
  279. echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import
  280. echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a Cryptomator-*.exe
  281. env:
  282. GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
  283. GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
  284. - name: Upload artifacts
  285. uses: actions/upload-artifact@v3
  286. with:
  287. name: exe
  288. path: |
  289. Cryptomator-*.exe
  290. Cryptomator-*.asc
  291. if-no-files-found: error
  292. - name: Publish .msi on GitHub Releases
  293. if: startsWith(github.ref, 'refs/tags/')
  294. uses: softprops/action-gh-release@v1
  295. with:
  296. fail_on_unmatched_files: true
  297. token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
  298. files: |
  299. Cryptomator-*.exe
  300. Cryptomator-*.asc
  301. allowlist:
  302. name: Anti Virus Allowlisting
  303. if: startsWith(github.ref, 'refs/tags/')
  304. runs-on: ubuntu-latest
  305. needs: [build-msi, build-exe]
  306. steps:
  307. - name: Download .msi
  308. uses: actions/download-artifact@v2
  309. with:
  310. name: msi
  311. path: msi
  312. - name: Download .exe
  313. uses: actions/download-artifact@v2
  314. with:
  315. name: exe
  316. path: exe
  317. - name: Collect files
  318. run: |
  319. mkdir files
  320. cp msi/*.msi files
  321. cp exe/*.exe files
  322. - name: Upload to Kaspersky
  323. uses: SamKirkland/FTP-Deploy-Action@4.3.0
  324. with:
  325. protocol: ftps
  326. server: allowlist.kaspersky-labs.com
  327. port: 990
  328. username: ${{ secrets.ALLOWLIST_KASPERSKY_USERNAME }}
  329. password: ${{ secrets.ALLOWLIST_KASPERSKY_PASSWORD }}
  330. local-dir: files/
  331. - name: Upload to Avast
  332. uses: SamKirkland/FTP-Deploy-Action@4.3.0
  333. with:
  334. protocol: ftp
  335. server: whitelisting.avast.com
  336. port: 21
  337. username: ${{ secrets.ALLOWLIST_AVAST_USERNAME }}
  338. password: ${{ secrets.ALLOWLIST_AVAST_PASSWORD }}
  339. local-dir: files/