Add Github Action workflow for deploying the npm package

This commit is contained in:
Daniel Tehrani
2023-03-28 11:32:54 +09:00
parent 4fa672024b
commit 2061eacf8b
3 changed files with 44 additions and 1 deletions

40
.github/workflows/publish.yaml vendored Normal file
View File

@@ -0,0 +1,40 @@
name: Publish Package to npmjs
on:
release:
types: [published]
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref_name }}
# Setup Node.js
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: "https://registry.npmjs.org"
# Setup Rust
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
# Install circom-secq
- uses: GuillaumeFalourd/clone-github-repo-action@v2
with:
owner: "DanTehrani"
repository: "circom-secq"
- run: cd circom-secq && cargo build --release && cargo install --path circom
# Install wasm-pack
- uses: jetli/wasm-pack-action@v0.4.0
with:
version: "0.10.3"
- run: cargo test
- run: yarn
- run: yarn build
- run: yarn test
- run: yarn publish
working-directory: ./packages/lib
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

View File

@@ -6,7 +6,8 @@
"repository": "https://github.com/DanTehrani/spartan-wasm.git",
"author": "Daniel Tehrani <contact@dantehrani.com>",
"scripts": {
"build": "sh ./scripts/build.sh && lerna run build"
"build": "sh ./scripts/build.sh && lerna run build",
"test": "sh ./scripts/test.sh"
},
"devDependencies": {
"@types/jest": "^29.2.4",

2
scripts/test.sh Normal file
View File

@@ -0,0 +1,2 @@
cargo test --release &&
yarn lerna run test