build.yml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  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@v4
  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@v4
  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. APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
  75. APPSTORE_USERNAME: ${{ secrets.APPSTORE_USERNAME }}
  76. APPSTORE_PASSWORD: ${{ secrets.APPSTORE_PASSWORD }}
  77. USE_HARD_LINKS: false
  78. # DEBUG: electron-builder,electron-builder:*
  79. - name: Build packages without signing
  80. run: scripts/build-macos.mjs
  81. if: "! (github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')))"
  82. env:
  83. ARCH: ${{matrix.arch}}
  84. # DEBUG: electron-builder,electron-builder:*
  85. - name: Upload symbols
  86. run: |
  87. sudo npm install -g @sentry/cli --unsafe-perm
  88. ./scripts/sentry-upload.mjs
  89. env:
  90. SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
  91. SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
  92. SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
  93. - name: Package artifacts
  94. run: |
  95. mkdir artifact-pkg
  96. mv dist/*.pkg artifact-pkg/
  97. mkdir artifact-zip
  98. mv dist/*.zip artifact-zip/
  99. - uses: actions/upload-artifact@master
  100. name: Upload PKG
  101. with:
  102. name: macOS .pkg (${{matrix.arch}})
  103. path: artifact-pkg
  104. - uses: actions/upload-artifact@master
  105. name: Upload ZIP
  106. with:
  107. name: macOS .zip (${{matrix.arch}})
  108. path: artifact-zip
  109. Linux-Build:
  110. runs-on: ubuntu-20.04
  111. needs: Lint
  112. strategy:
  113. matrix:
  114. include:
  115. - build-arch: x64
  116. arch: amd64
  117. - build-arch: arm64
  118. arch: arm64
  119. triplet: aarch64-linux-gnu-
  120. - build-arch: arm
  121. arch: armhf
  122. triplet: arm-linux-gnueabihf-
  123. env:
  124. CC: ${{matrix.triplet}}gcc
  125. CXX: ${{matrix.triplet}}g++
  126. ARCH: ${{matrix.build-arch}}
  127. npm_config_arch: ${{matrix.build-arch}}
  128. npm_config_target_arch: ${{matrix.build-arch}}
  129. steps:
  130. - name: Checkout
  131. uses: actions/checkout@v4
  132. with:
  133. fetch-depth: 0
  134. - name: Install Node
  135. uses: actions/[email protected]
  136. with:
  137. node-version: 18
  138. - name: Install deps (amd64)
  139. run: |
  140. sudo apt-get update
  141. sudo apt-get install libarchive-tools zsh
  142. - name: Install npm_modules (amd64)
  143. run: |
  144. npm i -g yarn
  145. yarn --network-timeout 1000000
  146. if: matrix.build-arch == 'x64'
  147. - name: Setup Crossbuild (${{matrix.arch}})
  148. run: |
  149. sudo apt-get update -y && sudo apt-get install schroot sbuild debootstrap -y
  150. sudo debootstrap --include=git,curl,gnupg,ca-certificates,crossbuild-essential-${{matrix.arch}},python-dev,python3-dev,libarchive-tools,cmake --variant=buildd --exclude=snapd --components=main,restricted,universe,multiverse --extractor=dpkg-deb bionic /build-chroot/
  151. echo 'deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse' | sudo tee /build-chroot/etc/apt/sources.list >/dev/null
  152. echo 'deb [arch=arm64,armhf] http://ports.ubuntu.com/ubuntu-ports bionic main restricted universe multiverse' | sudo tee -a /build-chroot/etc/apt/sources.list >/dev/null
  153. curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | sudo tee /build-chroot/etc/apt/trusted.gpg.d/nodesource.gpg >/dev/null
  154. echo 'deb http://deb.nodesource.com/node_16.x bionic main' | sudo tee /build-chroot/etc/apt/sources.list.d/nodesource.list >/dev/null
  155. echo "[build-chroot]
  156. description=Ubuntu 18.04 Build chroot
  157. type=directory
  158. directory=/build-chroot
  159. root-groups=root,sudo
  160. profile=buildd
  161. personality=linux
  162. union-type=overlay" | sudo tee /etc/schroot/chroot.d/build-chroot.pref >/dev/null
  163. echo "/home /home none rw,bind 0 0" | sudo tee -a /etc/schroot/buildd/fstab >/dev/null
  164. if: matrix.build-arch != 'x64'
  165. - name: Install node_modules & CrossBuild native modules for ${{matrix.arch}}
  166. run: |
  167. sudo schroot -c build-chroot -u root -- bash -c "apt-get update -y
  168. dpkg --add-architecture ${{matrix.arch}}
  169. apt-get install -y nodejs libfontconfig-dev:${{matrix.arch}} libsecret-1-dev:${{matrix.arch}} libnss3:${{matrix.arch}} libatk1.0-0:${{matrix.arch}} libatk-bridge2.0-0:${{matrix.arch}} libgdk-pixbuf2.0-0:${{matrix.arch}} libgtk-3-0:${{matrix.arch}} libgbm1:${{matrix.arch}}
  170. export CC=${{matrix.triplet}}gcc CXX=${{matrix.triplet}}g++ LD=${{matrix.triplet}}ld
  171. if [[ ${{matrix.arch}} == 'arm64' ]]; then
  172. export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/aarch64-linux-gnu/pkgconfig/
  173. elif [[ ${{matrix.arch}} == 'armhf' ]]; then
  174. export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/arm-linux-gnueabihf/pkgconfig/
  175. fi
  176. export ARCH=${{matrix.build-arch}} npm_config_arch=${{matrix.build-arch}} npm_config_target_arch=${{matrix.build-arch}}
  177. npm i -g yarn
  178. yarn --network-timeout 1000000 --arch=${{matrix.build-arch}} --target_arch=${{matrix.build-arch}}"
  179. if: matrix.build-arch != 'x64'
  180. - name: Webpack (${{matrix.arch}})
  181. run: yarn run build --arch=${{matrix.build-arch}} --target_arch=${{matrix.build-arch}}
  182. - name: Prepackage plugins (${{matrix.arch}})
  183. run: scripts/prepackage-plugins.mjs
  184. - name: Build packages (${{matrix.arch}})
  185. run: scripts/build-linux.mjs
  186. env:
  187. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  188. KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
  189. USE_HARD_LINKS: false
  190. # DEBUG: electron-builder,electron-builder:*
  191. - name: Build web resources
  192. run: zsh -c 'tar czf tabby-web.tar.gz (tabby-*|web)/dist'
  193. if: matrix.build-arch == 'x64'
  194. # - name: Install deps and Build (arm64)
  195. # uses: docker://multiarch/ubuntu-core:arm64-bionic
  196. # with:
  197. # args: >
  198. # bash -c
  199. # "apt update && apt install curl lsb-release gnupg -y &&
  200. # curl -fsSL https://deb.nodesource.com/setup_16.x | bash - &&
  201. # apt install make build-essential git ruby libarchive-tools nodejs rpm libsecret-1-dev libfontconfig1-dev -y &&
  202. # git config --global --add safe.directory /github/workspace &&
  203. # gem install public_suffix -v 4.0.7 &&
  204. # gem install fpm --no-document &&
  205. # npm i -g yarn &&
  206. # cd /github/workspace &&
  207. # yarn --network-timeout 1000000 &&
  208. # yarn run build &&
  209. # scripts/prepackage-plugins.mjs &&
  210. # USE_SYSTEM_FPM=true scripts/build-linux.mjs"
  211. # env:
  212. # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  213. # KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
  214. # USE_HARD_LINKS: false
  215. # if: matrix.build-arch == 'arm64' && github.repository == 'Eugeny/tabby' && startsWith(github.ref, 'refs/tags')
  216. # - name: Install deps and Build (armv7l)
  217. # uses: docker://multiarch/ubuntu-core:armhf-bionic
  218. # with:
  219. # args: >
  220. # bash -c
  221. # "apt update && apt install curl lsb-release gnupg -y &&
  222. # curl -fsSL https://deb.nodesource.com/setup_16.x | bash - &&
  223. # apt install make build-essential git ruby libarchive-tools nodejs rpm libsecret-1-dev libfontconfig1-dev -y &&
  224. # git config --global --add safe.directory /github/workspace &&
  225. # gem install public_suffix -v 4.0.7 &&
  226. # gem install fpm --no-document &&
  227. # npm i -g yarn &&
  228. # cd /github/workspace &&
  229. # sed -i '/ \"electron\":/c\ \"electron\": \"17.0.0\",' package.json &&
  230. # yarn --network-timeout 1000000 &&
  231. # yarn run build &&
  232. # scripts/prepackage-plugins.mjs &&
  233. # USE_SYSTEM_FPM=true scripts/build-linux.mjs"
  234. # env:
  235. # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  236. # KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
  237. # USE_HARD_LINKS: false
  238. # if: matrix.build-arch == 'arm' && github.repository == 'Eugeny/tabby' && startsWith(github.ref, 'refs/tags')
  239. - name: Upload symbols (amd64 only)
  240. run: |
  241. sudo npm install -g @sentry/cli --unsafe-perm
  242. ./scripts/sentry-upload.mjs
  243. if: matrix.build-arch == 'x64'
  244. env:
  245. SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
  246. SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
  247. SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
  248. - name: Upload packages to packagecloud.io
  249. uses: Eugeny/packagecloud-action@main
  250. if: github.repository == 'Eugeny/tabby' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
  251. env:
  252. PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
  253. with:
  254. repo: 'eugeny/tabby'
  255. dir: 'dist'
  256. - uses: actions/upload-artifact@master
  257. name: Upload AppImage (${{matrix.arch}})
  258. with:
  259. name: Linux AppImage (${{matrix.arch}})
  260. path: dist/*.AppImage
  261. - uses: actions/upload-artifact@master
  262. name: Upload DEB (${{matrix.arch}})
  263. with:
  264. name: Linux DEB (${{matrix.arch}})
  265. path: dist/*.deb
  266. - uses: actions/upload-artifact@master
  267. name: Upload RPM (${{matrix.arch}})
  268. with:
  269. name: Linux RPM (${{matrix.arch}})
  270. path: dist/*.rpm
  271. - uses: actions/upload-artifact@master
  272. name: Upload Pacman Package (${{matrix.arch}})
  273. with:
  274. name: Linux Pacman (${{matrix.arch}})
  275. path: dist/*.pacman
  276. - uses: actions/upload-artifact@master
  277. name: Upload Linux tarball (${{matrix.arch}})
  278. with:
  279. name: Linux tarball (${{matrix.arch}})
  280. path: dist/*.tar.gz
  281. - uses: actions/upload-artifact@master
  282. name: Upload web tarball (amd64 only)
  283. with:
  284. name: Web tarball
  285. path: tabby-web.tar.gz
  286. if: matrix.build-arch == 'x64'
  287. Windows-Build:
  288. runs-on: windows-2022
  289. needs: Lint
  290. strategy:
  291. matrix:
  292. include:
  293. - arch: x64
  294. - arch: arm64
  295. fail-fast: false
  296. steps:
  297. - name: Checkout
  298. uses: actions/checkout@v4
  299. with:
  300. fetch-depth: 0
  301. - name: Installing Node
  302. uses: actions/[email protected]
  303. with:
  304. node-version: 16
  305. - name: Update node-gyp
  306. run: |
  307. npm install --global [email protected]
  308. npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}
  309. - name: Build
  310. shell: powershell
  311. run: |
  312. npm i -g [email protected]
  313. yarn --network-timeout 1000000
  314. yarn run build
  315. node scripts/prepackage-plugins.mjs
  316. env:
  317. ARCH: ${{matrix.arch}}
  318. - name: Build and sign packages
  319. run: node scripts/build-windows.mjs
  320. if: github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags'))
  321. env:
  322. ARCH: ${{matrix.arch}}
  323. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  324. KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
  325. WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
  326. WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
  327. DEBUG: electron-builder,electron-builder:*
  328. - name: Build packages without signing
  329. run: node scripts/build-windows.mjs
  330. if: "!(github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')))"
  331. env:
  332. ARCH: ${{matrix.arch}}
  333. - name: Upload symbols
  334. run: |
  335. npm install @sentry/cli
  336. node scripts/sentry-upload.mjs
  337. env:
  338. SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
  339. SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
  340. SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
  341. - name: Package artifacts
  342. run: |
  343. mkdir artifact-setup
  344. mv dist/*-setup-*.exe artifact-setup/
  345. mkdir artifact-portable
  346. mv dist/*-portable-*.zip artifact-portable/
  347. - uses: actions/upload-artifact@master
  348. name: Upload installer
  349. with:
  350. name: Windows installer (${{matrix.arch}})
  351. path: artifact-setup
  352. - uses: actions/upload-artifact@master
  353. name: Upload portable build
  354. with:
  355. name: Windows portable build (${{matrix.arch}})
  356. path: artifact-portable