From 477ad41ff1f2d9218b022edb1c9c5a28e24be322 Mon Sep 17 00:00:00 2001 From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com> Date: Tue, 23 Jul 2024 12:34:58 +0200 Subject: [PATCH] Update build-binaries.yml --- .github/workflows/build-binaries.yml | 47 +++++++++++++++++++--------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build-binaries.yml b/.github/workflows/build-binaries.yml index 95506108a6..6fabfcbcd3 100644 --- a/.github/workflows/build-binaries.yml +++ b/.github/workflows/build-binaries.yml @@ -34,30 +34,47 @@ jobs: with: node-version: 20 - - name: Install pkg - run: npm install -g @yao-pkg/pkg - - - name: Install dependencies (backend) - run: npm install + - name: Set up QEMU + if: matrix.arch == 'arm64' && matrix.os == 'linux' + uses: docker/setup-qemu-action@v2 - - name: Rebuild native modules - if: matrix.os == 'linux' && matrix.arch == 'arm64' - run: npm rebuild + - name: Install dependencies and build (x64) + if: matrix.arch == 'x64' + run: | + npm install + npm install --prefix ../frontend + npm run binary:build - - name: Install dependencies (frontend) - run: npm install --prefix ../frontend + - name: Install dependencies and build (arm64) + if: matrix.arch == 'arm64' && matrix.os == 'linux' + run: | + docker run --rm -v ${{ github.workspace }}:/workspace --platform linux/arm64 node:20 bash -c " + cd /workspace/backend && npm install && + cd /workspace/frontend && npm install && npm run build && + cd /workspace/backend && npm run binary:build + " - - name: Prerequisites for pkg - run: npm run binary:build + - name: Install pkg + run: npm install -g @yao-pkg/pkg - - name: Package into node binary + - name: Package into node binary (x64) + if: matrix.arch == 'x64' run: | if [ "${{ matrix.os }}" != "linux" ]; then - pkg --no-bytecode --public-packages "*" --public --target ${{ matrix.target }}-${{ matrix.arch }} --native-build --output ./binary/infisical-core-${{ matrix.os }}-${{ matrix.arch }} . + pkg --no-bytecode --public-packages "*" --public --compress Brotli --target ${{ matrix.target }}-${{ matrix.arch }} --output ./binary/infisical-core-${{ matrix.os }}-${{ matrix.arch }} . else - pkg --no-bytecode --public-packages "*" --public --target ${{ matrix.target }}-${{ matrix.arch }} --native-build --output ./binary/infisical-core . + pkg --no-bytecode --public-packages "*" --public --compress Brotli --target ${{ matrix.target }}-${{ matrix.arch }} --output ./binary/infisical-core . fi + - name: Package into node binary (arm64) + if: matrix.arch == 'arm64' && matrix.os == 'linux' + run: | + docker run --rm -v ${{ github.workspace }}:/workspace --platform linux/arm64 node:20 bash -c " + cd /workspace/backend && + npm install -g @yao-pkg/pkg && + pkg --no-bytecode --public-packages '*' --public --compress Brotli --target ${{ matrix.target }}-${{ matrix.arch }} --output ./binary/infisical-core . + " + # Set up .deb package structure (Debian/Ubuntu only) - name: Set up .deb package structure if: matrix.os == 'linux'