From 87b67e6db69320692e0a1d5bc45a4b5ce1b4b3b1 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Thu, 6 Jun 2024 06:51:07 -0500 Subject: [PATCH] Add node release workflow --- .github/workflows/release-node-bindings.yml | 255 ++++++++++++++++++++ 1 file changed, 255 insertions(+) create mode 100644 .github/workflows/release-node-bindings.yml diff --git a/.github/workflows/release-node-bindings.yml b/.github/workflows/release-node-bindings.yml new file mode 100644 index 000000000..6e73766f4 --- /dev/null +++ b/.github/workflows/release-node-bindings.yml @@ -0,0 +1,255 @@ +name: Release Node Bindings + +on: + push: + +jobs: + build-linux: + runs-on: warp-ubuntu-latest-x64-8x + strategy: + fail-fast: false + matrix: + target: + - x86_64-unknown-linux-gnu + - x86_64-unknown-linux-musl + - aarch64-unknown-linux-gnu + - aarch64-unknown-linux-musl + include: + - target: x86_64-unknown-linux-gnu + output_target: linux-x64-gnu + - target: x86_64-unknown-linux-musl + output_target: linux-x64-musl + - target: aarch64-unknown-linux-gnu + output_target: linux-arm64-gnu + - target: aarch64-unknown-linux-musl + output_target: linux-arm64-musl + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: "Cache" + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + ./target/${{ matrix.target }} + key: ${{ matrix.target }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} + - name: Configure aarch64 toolchain + if: startsWith(matrix.target, 'aarch64') + run: | + sudo apt-get install -qq crossbuild-essential-arm64 crossbuild-essential-armhf + cat >>~/.cargo/config <> $GITHUB_PATH + shell: bash + - name: Install rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + target: ${{ matrix.target }} + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version-file: ".node-version" + cache-dependency-path: "bindings_node/yarn.lock" + cache: "yarn" + env: + SKIP_YARN_COREPACK_CHECK: "1" + - name: Enable corepack + run: corepack enable + - name: Install dependencies + run: | + cd bindings_node + yarn + - name: Build target + run: | + cd bindings_node + yarn build --target ${{ matrix.target }} + - name: Upload binding + uses: actions/upload-artifact@v4 + with: + name: bindings_node_${{ matrix.output_target }} + path: bindings_node/bindings_node.${{ matrix.output_target }}.node + retention-days: 1 + + publish: + runs-on: warp-ubuntu-latest-x64-8x + needs: [build-linux, build-macos, build-windows] + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + pattern: bindings_node_* + merge-multiple: true + path: bindings_node/dist + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version-file: ".node-version" + cache-dependency-path: "bindings_node/yarn.lock" + cache: "yarn" + env: + SKIP_YARN_COREPACK_CHECK: "1" + - name: Enable corepack + run: corepack enable + - name: List files + run: ls -la bindings_node/dist + # - name: Publish to NPM + # run: | + # cd bindings_node + # npm publish + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # NPM_TOKEN: ${{ secrets.NPM_TOKEN }}