win-exe.yml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  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 for MSI
  115. run: >
  116. mvn -B license:add-third-party
  117. "-Dlicense.thirdPartyFilename=license.rtf"
  118. "-Dlicense.outputDirectory=dist/win/resources"
  119. "-Dlicense.fileTemplate=dist/win/resources/licenseTemplate.ftl"
  120. "-Dlicense.includedScopes=compile"
  121. "-Dlicense.excludedGroups=^org\.cryptomator"
  122. "-Dlicense.failOnMissing=true"
  123. "-Dlicense.licenseMergesUrl=file:///${{ github.workspace }}/license/merges"
  124. shell: pwsh
  125. - name: Create MSI
  126. run: >
  127. ${JAVA_HOME}/bin/jpackage
  128. --verbose
  129. --type msi
  130. --win-upgrade-uuid bda45523-42b1-4cae-9354-a45475ed4775
  131. --app-image appdir/Cryptomator
  132. --dest installer
  133. --name Cryptomator
  134. --vendor "Skymatic GmbH"
  135. --copyright "(C) 2016 - 2022 Skymatic GmbH"
  136. --app-version "${{ steps.versions.outputs.semVerNum }}"
  137. --win-menu
  138. --win-dir-chooser
  139. --win-shortcut-prompt
  140. --win-update-url "https:\\cryptomator.org"
  141. --win-menu-group Cryptomator
  142. --resource-dir dist/win/resources
  143. --license-file dist/win/resources/license.rtf
  144. --file-associations dist/win/resources/FAvaultFile.properties
  145. env:
  146. JP_WIXWIZARD_RESOURCES: ${{ github.workspace }}/dist/win/resources # requires abs path, used in resources/main.wxs
  147. - name: Codesign MSI
  148. uses: skymatic/code-sign-action@v1
  149. with:
  150. certificate: ${{ secrets.WIN_CODESIGN_P12_BASE64 }}
  151. password: ${{ secrets.WIN_CODESIGN_P12_PW }}
  152. certificatesha1: FF52240075AD7D14AF25629FDF69635357C7D14B
  153. description: Cryptomator Installer
  154. timestampUrl: 'http://timestamp.digicert.com'
  155. folder: installer
  156. - name: Add possible alpha/beta tags to installer name
  157. run: mv installer/Cryptomator-*.msi Cryptomator-${{ steps.versions.outputs.semVerStr }}-x64.msi
  158. - name: Create detached GPG signature with key 615D449FE6E6A235
  159. run: |
  160. echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import
  161. echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a Cryptomator-*.msi
  162. env:
  163. GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
  164. GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
  165. - name: Upload artifacts
  166. uses: actions/upload-artifact@v3
  167. with:
  168. name: msi
  169. path: |
  170. Cryptomator-*.msi
  171. Cryptomator-*.asc
  172. if-no-files-found: error
  173. - name: Publish .msi on GitHub Releases
  174. if: startsWith(github.ref, 'refs/tags/')
  175. uses: softprops/action-gh-release@v1
  176. with:
  177. fail_on_unmatched_files: true
  178. token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
  179. files: |
  180. *.msi
  181. *.asc
  182. outputs:
  183. semVerNum: ${{ steps.versions.outputs.semVerNum }}
  184. semVerStr: ${{ steps.versions.outputs.semVerStr }}
  185. revNum: ${{ steps.versions.outputs.revNum }}
  186. publish-winget:
  187. name: Publish on winget repo
  188. runs-on: windows-latest
  189. needs: [build-msi]
  190. steps:
  191. - name: Submit package to Windows Package Manager Community Repository
  192. run: |
  193. iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
  194. $github = Get-Content '${{ github.event_path }}' | ConvertFrom-Json
  195. $installerUrl = $github.release.assets | Where-Object -Property name -match 'Cryptomator-*.msi' | Select -ExpandProperty browser_download_url -First 1
  196. .\wingetcreate.exe update Cryptomator.Cryptomator -s -v $github.release.tag_name -u $installerUrl -t ${{ secrets.CRYPTOBOT_WINGET_TOKEN }}
  197. shell: pwsh
  198. build-exe:
  199. name: Build .exe installer
  200. runs-on: windows-latest
  201. needs: [build-msi]
  202. steps:
  203. - uses: actions/checkout@v2
  204. - name: Download .msi
  205. uses: actions/download-artifact@v2
  206. with:
  207. name: msi
  208. path: dist/win/bundle/resources
  209. - name: Strip version info from msi file name
  210. run: mv dist/win/bundle/resources/Cryptomator*.msi dist/win/bundle/resources/Cryptomator.msi
  211. - uses: actions/setup-java@v2
  212. with:
  213. distribution: 'temurin'
  214. java-version: ${{ env.JAVA_VERSION }}
  215. cache: 'maven'
  216. - name: Generate license for exe
  217. run: >
  218. mvn -B license:add-third-party
  219. "-Dlicense.thirdPartyFilename=license.rtf"
  220. "-Dlicense.fileTemplate=dist/win/bundle/resources/licenseTemplate.ftl"
  221. "-Dlicense.outputDirectory=dist/win/bundle/resources"
  222. "-Dlicense.includedScopes=compile"
  223. "-Dlicense.excludedGroups=^org\.cryptomator"
  224. "-Dlicense.failOnMissing=true"
  225. "-Dlicense.licenseMergesUrl=file:///${{ github.workspace }}/license/merges"
  226. shell: pwsh
  227. - name: Download WinFsp
  228. run:
  229. curl --output dist/win/bundle/resources/winfsp.msi -L ${{ env.WINFSP_MSI }}
  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: FF52240075AD7D14AF25629FDF69635357C7D14B
  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: FF52240075AD7D14AF25629FDF69635357C7D14B
  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/