Skip to content

Release Node.js SDK #17

Release Node.js SDK

Release Node.js SDK #17

Workflow file for this run

---
name: Release Node.js SDK
run-name: Release Node.js SDK
on:
push:
tags:
- "*.*.*" # version, e.g. 1.0.0
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.sha }}
cancel-in-progress: true
defaults:
run:
shell: bash
working-directory: languages/node
jobs:
build-napi:
uses: ./.github/workflows/build-napi.yml
setup:
name: Setup
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
npm:
name: Publish NPM
runs-on: ubuntu-22.04
needs:
- setup
- build-napi
steps:
- name: Checkout repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Node
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: 18
cache: "npm"
cache-dependency-path: package-lock.json
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: languages/node/artifacts
# All the artifacts have been downloaded as subdirectories of the artifacts directory
# Example: artifacts/binding.js/binding.js
# Example: artifacts/binding.d.ts/binding.d.ts
# We need to move the artifacts to the root of the artifacts directory
- name: Move artifacts to root of artifacts directory
run: mkdir artifacts2 && find ./artifacts/* -type f -exec mv -i {} ./artifacts2/ \; && rm -rf ./artifacts && mv ./artifacts2 ./artifacts
- name: Move artifacts
run: npm run move:artifacts
- name: Install dependencies
run: npm ci
- name: Set NPM version #get the version from the tag
run: npm version ${{ github.ref_name }} --allow-same-version --no-git-tag-version
- name: Run tsc
run: npm run tsc
- name: Setup NPM
run: |
echo 'registry="https://registry.npmjs.org/"' > ./.npmrc
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ./.npmrc
echo 'registry="https://registry.npmjs.org/"' > ~/.npmrc
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Pack NPM
run: npm pack
#- name: Sleep 10 minutes
# run: sleep 600
- name: Publish NPM
run: npm publish --tarball=./sdk-${{github.ref_name}}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}