From 05fd7daf5235931874f096bf8d42f4567ad3d7b4 Mon Sep 17 00:00:00 2001 From: Huan-Cheng Chang Date: Tue, 21 Jan 2025 07:20:23 +0000 Subject: [PATCH] ci: build and upload cli binary --- .github/actions/build-cli/action.yml | 1 + .github/workflows/cli-npm.yaml | 45 ++++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/.github/actions/build-cli/action.yml b/.github/actions/build-cli/action.yml index 6b7ea685e..a977d8162 100644 --- a/.github/actions/build-cli/action.yml +++ b/.github/actions/build-cli/action.yml @@ -27,6 +27,7 @@ runs: - name: Upload binaries to release uses: svenstaro/upload-release-action@v2 with: + repo_name: huancheng-trili/test-cli repo_token: ${{ inputs.repo_token }} file: result/bin/jstz asset_name: jstz_${{ inputs.platform }}_${{ inputs.arch }} diff --git a/.github/workflows/cli-npm.yaml b/.github/workflows/cli-npm.yaml index aae687c5b..f34795ab8 100644 --- a/.github/workflows/cli-npm.yaml +++ b/.github/workflows/cli-npm.yaml @@ -2,6 +2,7 @@ name: Build npm package for jstz CLI on: push: + branches: [huanchengchang-jstz-275-1] tags: - "*" @@ -14,7 +15,7 @@ jobs: with: platform: macos arch: arm64 - repo_token: ${{ secrets.GITHUB_TOKEN }} + repo_token: ${{ secrets.TEST_RELEASE }} linux-amd64: name: Build CLI for Linux AMD64 runs-on: [x86_64, linux, nix] @@ -23,4 +24,44 @@ jobs: with: platform: linux arch: amd64 - repo_token: ${{ secrets.GITHUB_TOKEN }} + repo_token: ${{ secrets.TEST_RELEASE }} + linux-arm64: + # cannot easily build with nix on arm64 because mozjs does not have prebuilds for linux arm64 + # so we need to use make build-cli here + name: Build CLI for Linux Arm64 + runs-on: ubuntu-24.04-arm + container: + image: alpine + volumes: + - /:/host + steps: + # hack for github actions to work with arm64 + # https://github.com/actions/runner/issues/801#issuecomment-2394425757 + - name: Patch native Alpine NodeJS into Runner environment + run: | + apk add nodejs + sed -i "s:ID=alpine:ID=NotpineForGHA:" /etc/os-release + cd /host/home/runner/runners/*/externals/ + rm -rf node20/* + mkdir node20/bin + ln -s /usr/bin/node node20/bin/node + shell: sh + - name: Install dependencies + shell: sh + run: apk add make musl-dev libcrypto3 openssl-dev clang gcc musl-dev libstdc++ libffi-dev g++ openssl-libs-static bash curl + # curl and bash are required by dtolnay/rust-toolchain + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@1.80.0 + with: + targets: wasm32-unknown-unknown + - name: Build + shell: sh + run: make build-cli + - name: Upload binaries to release + uses: svenstaro/upload-release-action@v2 + with: + repo_name: huancheng-trili/test-cli + repo_token: ${{ secrets.TEST_RELEASE }} + file: target/release/jstz + asset_name: jstz_linux_arm64 + tag: ${{ github.ref_name }}