This repository has been archived by the owner on Jan 8, 2024. It is now read-only.
20221217 assign #881
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: npm publish | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
tags: | |
- '**' | |
pull_request: | |
branches: | |
- '**' | |
jobs: | |
build_npm: | |
name: Npm | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up rusts | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
components: rustfmt, clippy | |
- name: install wasm-pack | |
run: cargo install --version 0.11.1 wasm-pack | |
- name: wasm-pack build and pack | |
run: wasm-pack build --release --target=nodejs wasm && wasm-pack pack wasm | |
- name: Setup Node 16.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
- name: Test wasm | |
run: node wasm/tests/index.js | |
- name: Upload npm pkg artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: npm-pkg | |
path: ./wasm/pkg/clvm_tools_wasm-*.tgz | |
- name: Test for secrets access | |
id: check_secrets | |
shell: bash | |
run: | | |
unset HAS_SECRET | |
if [ -n "$SECRET" ]; then HAS_SECRET='true' ; fi | |
echo "HAS_SECRET=${HAS_SECRET}" >>$GITHUB_OUTPUT | |
env: | |
SECRET: "${{ secrets.test_pypi_password }}" | |
- name: Publish wasm | |
if: steps.check_secrets.HAS_SECRET | |
shell: bash | |
run: | | |
cd wasm/pkg | |
rm -f clvm_tools_wasm-*.tgz | |
npm publish --access public |