From 2229d54b337aed1b76f43bb11388b9f45c42bbac Mon Sep 17 00:00:00 2001 From: jai-jap Date: Mon, 21 Mar 2022 15:50:26 +0530 Subject: [PATCH] Revert "Delete build.yml" This reverts commit 332c5c0b5e2f242c83159e3314d02a50a8fef9d0. --- .github/workflows/build.yml | 335 ++++++++++++++++++++++++++++++++++++ 1 file changed, 335 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..4a5478b5 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,335 @@ +name: Package-Build +on: [push, pull_request] +jobs: + Lint: + runs-on: macos-11 + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Installing Node + uses: actions/setup-node@v3.0.0 + with: + node-version: 16 + + - name: Install deps + run: | + npm i -g yarn@1.19.1 + cd app + yarn + cd .. + rm app/node_modules/.yarn-integrity + yarn + + - name: Build typings + run: yarn run build:typings + + - name: Lint + run: yarn run lint + + macOS-Build: + runs-on: macos-11 + needs: Lint + strategy: + matrix: + include: + - arch: x86_64 + - arch: arm64 + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Installing Node + uses: actions/setup-node@v3.0.0 + with: + node-version: 16 + + - name: Install deps + run: | + sudo npm i -g yarn@1.22.1 + cd app + yarn --network-timeout 1000000 + cd .. + rm app/node_modules/.yarn-integrity + yarn --network-timeout 1000000 + + - name: Build native deps + run: scripts/build-native.js + env: + ARCH: ${{matrix.arch}} + + - name: Fix cross build + run: | + rm -rf app/node_modules/cpu-features + rm -rf app/node_modules/ssh2/crypto/build + if: ${{ matrix.arch == 'arm64' }} + + - name: Webpack + run: yarn run build + + - name: Prepackage plugins + run: scripts/prepackage-plugins.js + env: + ARCH: ${{matrix.arch}} + + - run: sed -i '' 's/updateInfo = await/\/\/updateInfo = await/g' node_modules/app-builder-lib/out/targets/ArchiveTarget.js + + - name: Build and sign packages + run: scripts/build-macos.js + if: github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')) + env: + ARCH: ${{matrix.arch}} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CSC_LINK: ${{ secrets.CSC_LINK }} + CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} + APPSTORE_USERNAME: ${{ secrets.APPSTORE_USERNAME }} + APPSTORE_PASSWORD: ${{ secrets.APPSTORE_PASSWORD }} + USE_HARD_LINKS: false + # DEBUG: electron-builder,electron-builder:* + + - name: Build packages without signing + run: scripts/build-macos.js + if: "! (github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')))" + env: + ARCH: ${{matrix.arch}} + # DEBUG: electron-builder,electron-builder:* + + - name: Upload symbols + run: | + sudo npm install -g @sentry/cli --unsafe-perm + ./scripts/sentry-upload.js + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + SENTRY_ORG: ${{ secrets.SENTRY_ORG }} + SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} + + - name: Package artifacts + run: | + mkdir artifact-pkg + mv dist/*.pkg artifact-pkg/ + mkdir artifact-zip + mv dist/*.zip artifact-zip/ + + - uses: actions/upload-artifact@master + name: Upload PKG + with: + name: macOS .pkg (${{matrix.arch}}) + path: artifact-pkg + + - uses: actions/upload-artifact@master + name: Upload ZIP + with: + name: macOS .zip (${{matrix.arch}}) + path: artifact-zip + + Linux-Build: + runs-on: ubuntu-18.04 # build against an older glibc for compatibility + needs: Lint + strategy: + matrix: + include: + - arch: x86_64 + - arch: armv7l + - arch: arm64 + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install Node + uses: actions/setup-node@v3.0.0 + with: + node-version: 16 + + - name: Install deps + run: | + sudo apt-get update + sudo apt-get install libarchive-tools zsh + npm i -g yarn@1.19.1 + cd app + yarn --network-timeout 1000000 + cd .. + rm app/node_modules/.yarn-integrity + yarn --network-timeout 1000000 + + - name: Build native deps + run: scripts/build-native.js + env: + ARCH: ${{matrix.arch}} + + - name: Fix cross build + run: | + rm -rf app/node_modules/cpu-features + rm -rf app/node_modules/ssh2/crypto/build + if: ${{ matrix.arch == 'arm64' || matrix.arch == 'armv7l' }} + + - name: Webpack + run: yarn run build + + - name: Prepackage plugins + run: scripts/prepackage-plugins.js + env: + ARCH: ${{matrix.arch}} + + - name: Build packages + run: scripts/build-linux.js + env: + ARCH: ${{matrix.arch}} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + USE_HARD_LINKS: false + # DEBUG: electron-builder,electron-builder:* + + - name: Build web resources + run: zsh -c 'tar czf tabby-web.tar.gz (tabby-*|web)/dist' + if: ${{ matrix.arch == 'x86_64' }} + + - name: Upload symbols + run: | + sudo npm install -g @sentry/cli --unsafe-perm + ./scripts/sentry-upload.js + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + SENTRY_ORG: ${{ secrets.SENTRY_ORG }} + SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} + if: ${{ matrix.arch == 'x86_64' }} + + - name: Upload packages to packagecloud.io + uses: Eugeny/packagecloud-action@main + if: github.repository == 'Eugeny/tabby' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + env: + PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }} + with: + repo: 'eugeny/tabby' + dir: 'dist' + + - name: Package artifacts + run: | + mkdir artifact-deb + mv dist/*.deb artifact-deb/ || true + mkdir artifact-rpm + mv dist/*.rpm artifact-rpm/ || true + mkdir artifact-pacman + mv dist/*.pacman artifact-pacman/ || true + mkdir artifact-tar.gz + mv dist/*.tar.gz artifact-tar.gz/ || true + mkdir artifact-web + mv tabby-web.tar.gz artifact-web/ || true + + - uses: actions/upload-artifact@master + name: Upload DEB + with: + name: Linux DEB (${{matrix.arch}}) + path: artifact-deb + + - uses: actions/upload-artifact@master + name: Upload RPM + with: + name: Linux RPM (${{matrix.arch}}) + path: artifact-rpm + + - uses: actions/upload-artifact@master + name: Upload Pacman Package + with: + name: Linux Pacman (${{matrix.arch}}) + path: artifact-pacman + + - uses: actions/upload-artifact@master + name: Upload Linux tarball + with: + name: Linux tarball (${{matrix.arch}}) + path: artifact-tar.gz + + - uses: actions/upload-artifact@master + name: Upload web tarball + with: + name: Web tarball + path: artifact-web + if: ${{ matrix.arch == 'x86_64' }} + + + Windows-Build: + runs-on: windows-2022 + needs: Lint + strategy: + matrix: + include: + - arch: x86_64 + - arch: arm64 + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Installing Node + uses: actions/setup-node@v3.0.0 + with: + node-version: 16 + + - name: Update node-gyp + run: | + npm install --global node-gyp@8.4.1 + npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"} + + - name: Build + shell: powershell + run: | + npm i -g yarn@1.19.1 + yarn --network-timeout 1000000 + node scripts/build-native.js + yarn run build + node scripts/prepackage-plugins.js + env: + ARCH: ${{matrix.arch}} + + - name: Build and sign packages + run: node scripts/build-windows.js + if: github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')) + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }} + WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }} + DEBUG: electron-builder,electron-builder:* + + - name: Build packages without signing + run: node scripts/build-windows.js + if: "!(github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')))" + env: + ARCH: ${{matrix.arch}} + + - name: Upload symbols + run: | + npm install @sentry/cli + node scripts/sentry-upload.js + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + SENTRY_ORG: ${{ secrets.SENTRY_ORG }} + SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} + + - name: Package artifacts + run: | + mkdir artifact-setup + mv dist/*-setup-*.exe artifact-setup/ + mkdir artifact-portable + mv dist/*-portable-*.zip artifact-portable/ + + - uses: actions/upload-artifact@master + name: Upload installer + with: + name: Windows installer (${{matrix.arch}}) + path: artifact-setup + + - uses: actions/upload-artifact@master + name: Upload portable build + with: + name: Windows portable build (${{matrix.arch}}) + path: artifact-portable