build.yml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. name: Package-Build
  2. on: [push, pull_request]
  3. jobs:
  4. Lint:
  5. runs-on: ubuntu-20.04
  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: 18
  15. - name: Install deps
  16. run: |
  17. npm i -g yarn
  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-12
  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: 18
  45. - name: Install deps
  46. run: |
  47. sudo -H pip3 install setuptools
  48. sudo npm i -g yarn
  49. yarn --network-timeout 1000000
  50. env:
  51. ARCH: ${{matrix.arch}}
  52. - name: Fix cross build
  53. run: |
  54. rm -rf app/node_modules/cpu-features
  55. rm -rf app/node_modules/ssh2/crypto/build
  56. if: matrix.arch == 'arm64'
  57. - name: Webpack
  58. run: yarn run build
  59. - name: Prepackage plugins
  60. run: scripts/prepackage-plugins.mjs
  61. env:
  62. ARCH: ${{matrix.arch}}
  63. - run: sed -i '' 's/updateInfo = await/\/\/updateInfo = await/g' node_modules/app-builder-lib/out/targets/ArchiveTarget.js
  64. # Work around electron-builder beta bug
  65. - run: ln -s ../../node_modules/electron app/node_modules
  66. - name: Build and sign packages
  67. run: scripts/build-macos.mjs
  68. if: github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags'))
  69. env:
  70. ARCH: ${{matrix.arch}}
  71. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  72. KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
  73. CSC_LINK: ${{ secrets.CSC_LINK }}
  74. CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
  75. APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
  76. APPSTORE_USERNAME: ${{ secrets.APPSTORE_USERNAME }}
  77. APPSTORE_PASSWORD: ${{ secrets.APPSTORE_PASSWORD }}
  78. USE_HARD_LINKS: false
  79. # DEBUG: electron-builder,electron-builder:*
  80. - name: Build packages without signing
  81. run: scripts/build-macos.mjs
  82. if: "! (github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')))"
  83. env:
  84. ARCH: ${{matrix.arch}}
  85. # DEBUG: electron-builder,electron-builder:*
  86. - name: Upload symbols
  87. run: |
  88. sudo npm install -g @sentry/cli --unsafe-perm
  89. ./scripts/sentry-upload.mjs
  90. env:
  91. SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
  92. SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
  93. SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
  94. - name: Package artifacts
  95. run: |
  96. mkdir artifact-dmg
  97. mv dist/*.dmg artifact-dmg/
  98. mkdir artifact-zip
  99. mv dist/*.zip artifact-zip/
  100. - uses: actions/upload-artifact@master
  101. name: Upload DMG
  102. with:
  103. name: macOS .dmg (${{matrix.arch}})
  104. path: artifact-dmg
  105. - uses: actions/upload-artifact@master
  106. name: Upload ZIP
  107. with:
  108. name: macOS .zip (${{matrix.arch}})
  109. path: artifact-zip
  110. Linux-Build:
  111. runs-on: ubuntu-20.04
  112. needs: Lint
  113. strategy:
  114. matrix:
  115. include:
  116. - build-arch: x64
  117. arch: amd64
  118. - build-arch: arm64
  119. arch: arm64
  120. triplet: aarch64-linux-gnu-
  121. - build-arch: arm
  122. arch: armhf
  123. triplet: arm-linux-gnueabihf-
  124. env:
  125. CC: ${{matrix.triplet}}gcc
  126. CXX: ${{matrix.triplet}}g++
  127. ARCH: ${{matrix.build-arch}}
  128. npm_config_arch: ${{matrix.build-arch}}
  129. npm_config_target_arch: ${{matrix.build-arch}}
  130. steps:
  131. - name: Checkout
  132. uses: actions/checkout@v3
  133. with:
  134. fetch-depth: 0
  135. - name: Install Node
  136. uses: actions/[email protected]
  137. with:
  138. node-version: 18
  139. - name: Install dependencies
  140. run: |
  141. sudo apt-get update
  142. sudo apt-get install libarchive-tools zsh crossbuild-essential-${{matrix.arch}}
  143. - name: Setup tar to run as root
  144. run: sudo chmod u+s "$(command -v tar)"
  145. if: matrix.build-arch != 'x64'
  146. - name: Download cached sysroot
  147. uses: actions/cache@v3
  148. id: dl-cached-sysroot
  149. if: matrix.build-arch !='x64'
  150. with:
  151. key: sysroot-${{matrix.build-arch}}
  152. path: /${{matrix.build-arch}}-sysroot
  153. - name: Setup crossbuild sysroot
  154. run: |
  155. sudo apt-get update -y && sudo apt-get install debootstrap qemu-user-static binfmt-support -y
  156. sudo qemu-debootstrap --include=libfontconfig1-dev,libsecret-1-dev,libnss3,libatk1.0-0,libatk-bridge2.0-0,libgdk-pixbuf2.0-0,libgtk-3-0,libgbm1 --variant=buildd --exclude=snapd --components=main,restricted,universe,multiverse --extractor=dpkg-deb --arch ${{matrix.arch}} bionic /${{matrix.build-arch}}-sysroot/ http://ports.ubuntu.com/ubuntu-ports/
  157. sudo find /${{matrix.build-arch}}-sysroot -type l -lname '/*' -exec sh -c 'file="$0"; dir=$(dirname "$file"); target=$(readlink "$0"); prefix=$(dirname "$dir" | sed 's@[^/]*@\.\.@g'); newtarget="$prefix$target"; ln -snf $newtarget $file' {} \; ;
  158. if: matrix.build-arch != 'x64' && steps.dl-cached-sysroot.outputs.cache-hit != 'true'
  159. - name: Setup env to use ${{matrix.build-arch}} sysroot
  160. run: |
  161. echo "CFLAGS=--sysroot=/${{matrix.build-arch}}-sysroot/" >> $GITHUB_ENV
  162. echo "CXXFLAGS=--sysroot=/${{matrix.build-arch}}-sysroot/" >> $GITHUB_ENV
  163. echo "LDFLAGS=--sysroot=/${{matrix.build-arch}}-sysroot/" >> $GITHUB_ENV
  164. [[ ${npm_config_arch} == 'arm' ]] && echo "npm_config_arch=armv7l" >> $GITHUB_ENV
  165. if [[ ${{matrix.arch}} == 'armhf' ]]; then
  166. echo "PKG_CONFIG_PATH=/${{matrix.build-arch}}-sysroot/usr/lib/pkgconfig/:/${{matrix.build-arch}}-sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig/" >> $GITHUB_ENV
  167. elif [[ ${{matrix.arch}} == 'arm64' ]]; then
  168. echo "PKG_CONFIG_PATH=/${{matrix.build-arch}}-sysroot/usr/lib/pkgconfig/:/${{matrix.build-arch}}-sysroot/usr/lib/aarch64-linux-gnu/pkgconfig/" >> $GITHUB_ENV
  169. fi
  170. if: matrix.build-arch != 'x64'
  171. - name: Install npm_modules (amd64)
  172. run: |
  173. npm i -g yarn node-gyp
  174. yarn --network-timeout 1000000 --arch=${{matrix.build-arch}} --target-arch=${{matrix.build-arch}}
  175. - name: Webpack (${{matrix.arch}})
  176. run: yarn run build --arch=${{matrix.build-arch}} --target_arch=${{matrix.build-arch}}
  177. - name: Prepackage plugins (${{matrix.arch}})
  178. run: scripts/prepackage-plugins.mjs
  179. - name: Build packages (${{matrix.arch}})
  180. run: scripts/build-linux.mjs
  181. env:
  182. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  183. KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
  184. USE_HARD_LINKS: false
  185. # DEBUG: electron-builder,electron-builder:*
  186. - name: Build web resources (amd64 only)
  187. run: zsh -c 'tar czf tabby-web.tar.gz (tabby-*|web)/dist'
  188. if: matrix.build-arch == 'x64'
  189. - name: Upload symbols (amd64 only)
  190. run: |
  191. sudo npm install -g @sentry/cli --unsafe-perm
  192. ./scripts/sentry-upload.mjs
  193. if: matrix.build-arch == 'x64'
  194. env:
  195. SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
  196. SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
  197. SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
  198. - name: Upload packages to packagecloud.io
  199. uses: Eugeny/packagecloud-action@main
  200. if: github.repository == 'Eugeny/tabby' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
  201. env:
  202. PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
  203. with:
  204. repo: 'eugeny/tabby'
  205. dir: 'dist'
  206. - uses: actions/upload-artifact@master
  207. name: Upload AppImage (${{matrix.arch}})
  208. with:
  209. name: Linux AppImage (${{matrix.arch}})
  210. path: dist/*.AppImage
  211. - uses: actions/upload-artifact@master
  212. name: Upload DEB (${{matrix.arch}})
  213. with:
  214. name: Linux DEB (${{matrix.arch}})
  215. path: dist/*.deb
  216. - uses: actions/upload-artifact@master
  217. name: Upload RPM (${{matrix.arch}})
  218. with:
  219. name: Linux RPM (${{matrix.arch}})
  220. path: dist/*.rpm
  221. - uses: actions/upload-artifact@master
  222. name: Upload Pacman Package (${{matrix.arch}})
  223. with:
  224. name: Linux Pacman (${{matrix.arch}})
  225. path: dist/*.pacman
  226. - uses: actions/upload-artifact@master
  227. name: Upload Linux tarball (${{matrix.arch}})
  228. with:
  229. name: Linux tarball (${{matrix.arch}})
  230. path: dist/*.tar.gz
  231. - uses: actions/upload-artifact@master
  232. name: Upload web tarball (amd64 only)
  233. with:
  234. name: Web tarball
  235. path: tabby-web.tar.gz
  236. if: matrix.build-arch == 'x64'
  237. Windows-Build:
  238. runs-on: windows-2022
  239. needs: Lint
  240. strategy:
  241. matrix:
  242. include:
  243. - arch: x64
  244. - arch: arm64
  245. fail-fast: false
  246. steps:
  247. - name: Checkout
  248. uses: actions/checkout@v3
  249. with:
  250. fetch-depth: 0
  251. - name: Installing Node
  252. uses: actions/[email protected]
  253. with:
  254. node-version: 18
  255. - name: Build
  256. shell: powershell
  257. run: |
  258. npm i -g yar node-gyp
  259. yarn --network-timeout 1000000
  260. yarn run build
  261. node scripts/prepackage-plugins.mjs
  262. env:
  263. ARCH: ${{matrix.arch}}
  264. - name: Build and sign packages
  265. run: node scripts/build-windows.mjs
  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. KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
  271. WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
  272. WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
  273. DEBUG: electron-builder,electron-builder:*
  274. - name: Build packages without signing
  275. run: node scripts/build-windows.mjs
  276. if: "! (github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')))"
  277. env:
  278. ARCH: ${{matrix.arch}}
  279. - name: Upload symbols
  280. run: |
  281. npm install @sentry/cli
  282. node scripts/sentry-upload.mjs
  283. env:
  284. SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
  285. SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
  286. SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
  287. - name: Package artifacts
  288. run: |
  289. mkdir artifact-setup
  290. mv dist/*-setup-*.exe artifact-setup/
  291. mkdir artifact-portable
  292. mv dist/*-portable-*.zip artifact-portable/
  293. - uses: actions/upload-artifact@master
  294. name: Upload installer
  295. with:
  296. name: Windows installer (${{matrix.arch}})
  297. path: artifact-setup
  298. - uses: actions/upload-artifact@master
  299. name: Upload portable build
  300. with:
  301. name: Windows portable build (${{matrix.arch}})
  302. path: artifact-portable