build.yml 10 KB

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