build.yml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. name: Package-Build
  2. on: [push, pull_request]
  3. jobs:
  4. Lint:
  5. runs-on: macos-11
  6. steps:
  7. - name: Checkout
  8. uses: actions/checkout@v3
  9. with:
  10. fetch-depth: 0
  11. - name: Installing Node
  12. uses: actions/[email protected]
  13. with:
  14. node-version: 16
  15. - name: Install deps
  16. run: |
  17. npm i -g [email protected]
  18. cd app
  19. yarn
  20. cd ..
  21. rm app/node_modules/.yarn-integrity
  22. yarn
  23. - name: Build typings
  24. run: yarn run build:typings
  25. - name: Lint
  26. run: yarn run lint
  27. macOS-Build:
  28. runs-on: macos-11
  29. needs: Lint
  30. strategy:
  31. matrix:
  32. include:
  33. - arch: x86_64
  34. - arch: arm64
  35. fail-fast: false
  36. steps:
  37. - name: Checkout
  38. uses: actions/checkout@v3
  39. with:
  40. fetch-depth: 0
  41. - name: Installing Node
  42. uses: actions/[email protected]
  43. with:
  44. node-version: 16
  45. - name: Install deps
  46. run: |
  47. sudo npm i -g [email protected]
  48. yarn --network-timeout 1000000
  49. env:
  50. ARCH: ${{matrix.arch}}
  51. - name: Fix cross build
  52. run: |
  53. rm -rf app/node_modules/cpu-features
  54. rm -rf app/node_modules/ssh2/crypto/build
  55. if: matrix.arch == 'arm64'
  56. - name: Webpack
  57. run: yarn run build
  58. - name: Prepackage plugins
  59. run: scripts/prepackage-plugins.mjs
  60. env:
  61. ARCH: ${{matrix.arch}}
  62. - run: sed -i '' 's/updateInfo = await/\/\/updateInfo = await/g' node_modules/app-builder-lib/out/targets/ArchiveTarget.js
  63. # Work around electron-builder beta bug
  64. - run: ln -s ../../node_modules/electron app/node_modules
  65. - name: Build and sign packages
  66. run: scripts/build-macos.mjs
  67. if: github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags'))
  68. env:
  69. ARCH: ${{matrix.arch}}
  70. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  71. KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
  72. CSC_LINK: ${{ secrets.CSC_LINK }}
  73. CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
  74. APPSTORE_USERNAME: ${{ secrets.APPSTORE_USERNAME }}
  75. APPSTORE_PASSWORD: ${{ secrets.APPSTORE_PASSWORD }}
  76. USE_HARD_LINKS: false
  77. # DEBUG: electron-builder,electron-builder:*
  78. - name: Build packages without signing
  79. run: scripts/build-macos.mjs
  80. if: "! (github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')))"
  81. env:
  82. ARCH: ${{matrix.arch}}
  83. # DEBUG: electron-builder,electron-builder:*
  84. - name: Upload symbols
  85. run: |
  86. sudo npm install -g @sentry/cli --unsafe-perm
  87. ./scripts/sentry-upload.mjs
  88. env:
  89. SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
  90. SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
  91. SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
  92. - name: Package artifacts
  93. run: |
  94. mkdir artifact-pkg
  95. mv dist/*.pkg artifact-pkg/
  96. mkdir artifact-zip
  97. mv dist/*.zip artifact-zip/
  98. - uses: actions/upload-artifact@master
  99. name: Upload PKG
  100. with:
  101. name: macOS .pkg (${{matrix.arch}})
  102. path: artifact-pkg
  103. - uses: actions/upload-artifact@master
  104. name: Upload ZIP
  105. with:
  106. name: macOS .zip (${{matrix.arch}})
  107. path: artifact-zip
  108. Linux-Build:
  109. runs-on: ubuntu-18.04 # build against an older glibc for compatibility
  110. needs: Lint
  111. strategy:
  112. matrix:
  113. build-arch: [ x64, arm64, armv7l ]
  114. steps:
  115. - name: Checkout
  116. uses: actions/checkout@v3
  117. with:
  118. fetch-depth: 0
  119. - name: Set up multiarch/qemu-user-static
  120. run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
  121. if: matrix.build-arch != 'x64'
  122. - name: Install Node (x64)
  123. uses: actions/[email protected]
  124. with:
  125. node-version: 16
  126. if: matrix.build-arch == 'x64'
  127. - name: Install deps (x64)
  128. run: |
  129. sudo apt-get update
  130. sudo apt-get install libarchive-tools zsh
  131. npm i -g yarn
  132. yarn --network-timeout 1000000
  133. if: matrix.build-arch == 'x64'
  134. - name: Webpack (x64)
  135. run: yarn run build
  136. if: matrix.build-arch == 'x64'
  137. - name: Prepackage plugins (x64)
  138. run: scripts/prepackage-plugins.mjs
  139. if: ${{matrix.build-arch == 'x64'}}
  140. - name: Build packages (x64)
  141. run: scripts/build-linux.mjs
  142. if: ${{matrix.build-arch == 'x64'}}
  143. env:
  144. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  145. KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
  146. USE_HARD_LINKS: false
  147. # DEBUG: electron-builder,electron-builder:*
  148. - name: Build web resources
  149. run: zsh -c 'tar czf tabby-web.tar.gz (tabby-*|web)/dist'
  150. if: matrix.build-arch == 'x64'
  151. - name: Install deps and Build (arm64)
  152. uses: docker://multiarch/ubuntu-core:arm64-bionic
  153. with:
  154. args: >
  155. bash -c
  156. "apt update && apt install curl lsb-release gnupg -y &&
  157. curl -fsSL https://deb.nodesource.com/setup_16.x | bash - &&
  158. apt install make build-essential git ruby libarchive-tools nodejs rpm libsecret-1-dev libfontconfig1-dev -y &&
  159. git config --global --add safe.directory /github/workspace &&
  160. gem install public_suffix -v 4.0.7 &&
  161. gem install fpm --no-document &&
  162. npm i -g yarn &&
  163. cd /github/workspace &&
  164. yarn --network-timeout 1000000 &&
  165. yarn run build &&
  166. scripts/prepackage-plugins.mjs &&
  167. USE_SYSTEM_FPM=true scripts/build-linux.mjs"
  168. env:
  169. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  170. KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
  171. USE_HARD_LINKS: false
  172. if: matrix.build-arch == 'arm64' && github.repository == 'Eugeny/tabby' && startsWith(github.ref, 'refs/tags')
  173. - name: Install deps and Build (armv7l)
  174. uses: docker://multiarch/ubuntu-core:armhf-bionic
  175. with:
  176. args: >
  177. bash -c
  178. "apt update && apt install curl lsb-release gnupg -y &&
  179. curl -fsSL https://deb.nodesource.com/setup_16.x | bash - &&
  180. apt install make build-essential git ruby libarchive-tools nodejs rpm libsecret-1-dev libfontconfig1-dev -y &&
  181. git config --global --add safe.directory /github/workspace &&
  182. gem install public_suffix -v 4.0.7 &&
  183. gem install fpm --no-document &&
  184. npm i -g yarn &&
  185. cd /github/workspace &&
  186. sed -i '/ \"electron\":/c\ \"electron\": \"17.0.0\",' package.json &&
  187. yarn --network-timeout 1000000 &&
  188. yarn run build &&
  189. scripts/prepackage-plugins.mjs &&
  190. USE_SYSTEM_FPM=true scripts/build-linux.mjs"
  191. env:
  192. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  193. KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
  194. USE_HARD_LINKS: false
  195. if: matrix.build-arch == 'armv7l' && github.repository == 'Eugeny/tabby' && startsWith(github.ref, 'refs/tags')
  196. - name: Upload symbols
  197. run: |
  198. sudo npm install -g @sentry/cli --unsafe-perm
  199. ./scripts/sentry-upload.mjs
  200. if: matrix.build-arch == 'x64'
  201. env:
  202. SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
  203. SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
  204. SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
  205. - name: Upload packages to packagecloud.io
  206. uses: Eugeny/packagecloud-action@main
  207. if: github.repository == 'Eugeny/tabby' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
  208. env:
  209. PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
  210. with:
  211. repo: 'eugeny/tabby'
  212. dir: 'dist'
  213. - uses: actions/upload-artifact@master
  214. name: Upload DEB
  215. with:
  216. name: Linux DEB (${{matrix.build-arch}})
  217. path: dist/*.deb
  218. - uses: actions/upload-artifact@master
  219. name: Upload RPM
  220. with:
  221. name: Linux RPM (${{matrix.build-arch}})
  222. path: dist/*.rpm
  223. - uses: actions/upload-artifact@master
  224. name: Upload Pacman Package
  225. with:
  226. name: Linux Pacman (${{matrix.build-arch}})
  227. path: dist/*.pacman
  228. - uses: actions/upload-artifact@master
  229. name: Upload Linux tarball
  230. with:
  231. name: Linux tarball (${{matrix.build-arch}})
  232. path: dist/*.tar.gz
  233. - uses: actions/upload-artifact@master
  234. name: Upload web tarball
  235. with:
  236. name: Web tarball
  237. path: tabby-web.tar.gz
  238. if: matrix.build-arch == 'x64'
  239. Windows-Build:
  240. runs-on: windows-2022
  241. needs: Lint
  242. strategy:
  243. matrix:
  244. include:
  245. - arch: x64
  246. - arch: arm64
  247. fail-fast: false
  248. steps:
  249. - name: Checkout
  250. uses: actions/checkout@v3
  251. with:
  252. fetch-depth: 0
  253. - name: Installing Node
  254. uses: actions/[email protected]
  255. with:
  256. node-version: 16
  257. - name: Update node-gyp
  258. run: |
  259. npm install --global [email protected]
  260. npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}
  261. - name: Build
  262. shell: powershell
  263. run: |
  264. npm i -g [email protected]
  265. yarn --network-timeout 1000000
  266. yarn run build
  267. node scripts/prepackage-plugins.mjs
  268. env:
  269. ARCH: ${{matrix.arch}}
  270. - name: Build and sign packages
  271. run: node scripts/build-windows.mjs
  272. if: github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags'))
  273. env:
  274. ARCH: ${{matrix.arch}}
  275. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  276. KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
  277. WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
  278. WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
  279. DEBUG: electron-builder,electron-builder:*
  280. - name: Build packages without signing
  281. run: node scripts/build-windows.mjs
  282. if: "!(github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')))"
  283. env:
  284. ARCH: ${{matrix.arch}}
  285. - name: Upload symbols
  286. run: |
  287. npm install @sentry/cli
  288. node scripts/sentry-upload.mjs
  289. env:
  290. SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
  291. SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
  292. SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
  293. - name: Package artifacts
  294. run: |
  295. mkdir artifact-setup
  296. mv dist/*-setup-*.exe artifact-setup/
  297. mkdir artifact-portable
  298. mv dist/*-portable-*.zip artifact-portable/
  299. - uses: actions/upload-artifact@master
  300. name: Upload installer
  301. with:
  302. name: Windows installer (${{matrix.arch}})
  303. path: artifact-setup
  304. - uses: actions/upload-artifact@master
  305. name: Upload portable build
  306. with:
  307. name: Windows portable build (${{matrix.arch}})
  308. path: artifact-portable