From 8562826d4deccbe4808f6677fec5f3efa9aba28c Mon Sep 17 00:00:00 2001 From: OJ Kwon <1210596+kwonoj@users.noreply.github.com> Date: Tue, 22 Nov 2022 08:01:05 +0000 Subject: [PATCH] build(publish): upload cli binaries to gh release --- .github/workflows/publish-node.yml | 8 ++++++++ scripts/cli_upload_gh_release.sh | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100755 scripts/cli_upload_gh_release.sh diff --git a/.github/workflows/publish-node.yml b/.github/workflows/publish-node.yml index 28078919dd62..18b65848222d 100644 --- a/.github/workflows/publish-node.yml +++ b/.github/workflows/publish-node.yml @@ -464,3 +464,11 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Upload CLI binaries to gh release + shell: bash + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RELEASE_VERSION: ${{ env.RELEASE_VERSION }} + run: | + ./scripts/cli_upload_gh_release.sh \ No newline at end of file diff --git a/scripts/cli_upload_gh_release.sh b/scripts/cli_upload_gh_release.sh new file mode 100755 index 000000000000..832521ab9662 --- /dev/null +++ b/scripts/cli_upload_gh_release.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +# Naive substitution to napi artifacts for the cli binary. +for filename in artifacts/*/*.node +do + BINDING_NAME=${filename#*.} + BINDING_ABI=${BINDING_NAME%%.*} + CLI_BINARY_PATH=${filename%%.*} + + if [ -f "$CLI_BINARY_PATH" ]; then + chmod +x $CLI_BINARY_PATH + gh release upload $RELEASE_VERSION ./scripts/npm/$BINDING_ABI/$CLI_BINARY_PATH + elif [ -f "$CLI_BINARY_PATH.exe" ]; then + gh release upload $RELEASE_VERSION ./scripts/npm/$BINDING_ABI/$CLI_BINARY_PATH/$CLI_BINARY_PATH.exe + fi +done \ No newline at end of file