cff370a943
* Update scripts + CI for dryrun + version checking * Update publish.sh w trap * Coderabbit
61 lines
1.7 KiB
YAML
61 lines
1.7 KiB
YAML
name: publish-sdk-npm
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
dry_run:
|
|
description: "Rehearse the publish (pnpm publish --dry-run, no tarballs uploaded). Untick to publish for real."
|
|
type: boolean
|
|
default: true
|
|
dist_tag:
|
|
description: "Tag mode. 'auto' picks per package: new packages and same-major releases -> latest; a breaking major (e.g. mix-fetch v2 over v1) -> next, promote later with `npm dist-tag add`. 'next'/'latest' force that tag on all four."
|
|
type: choice
|
|
options:
|
|
- auto
|
|
- next
|
|
- latest
|
|
default: auto
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v5.0.0
|
|
with:
|
|
version: 11.1.2
|
|
|
|
- name: Install Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 24
|
|
registry-url: "https://registry.npmjs.org"
|
|
|
|
- name: Install rust toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: ${{ vars.REQUIRED_RUSTC_VERSION }}
|
|
override: true
|
|
components: rustfmt, clippy
|
|
|
|
- name: Install wasm-pack
|
|
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
|
|
|
- name: Install wasm-opt
|
|
run: cargo install wasm-opt
|
|
|
|
- name: Install dependencies
|
|
run: pnpm i
|
|
|
|
- name: Build WASM and Typescript SDK
|
|
run: pnpm sdk:build
|
|
|
|
- name: Publish to NPM
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
|
|
DRY_RUN: ${{ inputs.dry_run && '1' || '0' }}
|
|
NPM_DIST_TAG: ${{ inputs.dist_tag }}
|
|
run: ./sdk/typescript/scripts/publish.sh
|