Add GH Actions workflow to publish the SDK
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
name: Publish SDK to NPM
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: sdk/typescript/packages/sdk
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: [custom-runner-linux]
|
||||
steps:
|
||||
- name: Install Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- name: Setup yarn
|
||||
run: npm install -g yarn
|
||||
|
||||
- name: Install Rust stable
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
|
||||
- name: Install wasm-pack
|
||||
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
||||
|
||||
- name: Build and publish
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
|
||||
run: scripts/publish.sh
|
||||
@@ -34,6 +34,16 @@ The output bundle will be created in the `dist` directory.
|
||||
|
||||
If you're a Nym platform developer who's made changes to the Rust (or JS) files and wants to re-publish the package to NPM, here's how you do it:
|
||||
|
||||
Make sure you have logged into the NPM registry (`npm login`).
|
||||
|
||||
### Scripted
|
||||
|
||||
1. bump version numbers as necessary for SemVer
|
||||
2. make sure you're in the SDK directory (`cd sdk/typescript/packages/sdk`)
|
||||
3. run `scripts/publish.sh`
|
||||
|
||||
### Manually
|
||||
|
||||
1. bump version numbers as necessary for SemVer
|
||||
2. `yarn build` builds the release directory in the root of the repo in `dist/sdk`
|
||||
3. `cd ../../../../dist/sdk`
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nymproject/sdk",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8",
|
||||
"license": "Apache-2.0",
|
||||
"author": "Nym Technologies SA",
|
||||
"type": "module",
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
rm -rf dist || true
|
||||
rm -rf ../../../../dist || true
|
||||
|
||||
yarn
|
||||
yarn build
|
||||
cd ../../../../dist/sdk
|
||||
|
||||
cd cjs
|
||||
echo "Publishing CommonJS package to NPM.."
|
||||
npm publish --access=public
|
||||
cd ..
|
||||
|
||||
cd esm
|
||||
echo "Publishing ESM package to NPM.."
|
||||
npm publish --access=public
|
||||
cd ..
|
||||
Reference in New Issue
Block a user