name: Manual NPM Package Publish on: workflow_dispatch: inputs: working_directory: description: 'Working directory (e.g., libs/client-api-wasm)' required: true default: 'libs/client-api-wasm' package_name: description: 'Which package to publish' required: true default: '@appflowyinc/client-api-wasm' type: choice options: - '@appflowyinc/client-api-wasm' package_version: description: 'Package version' required: true env: NODE_VERSION: '20.12.0' RUST_TOOLCHAIN: "1.80.0" jobs: publish: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: toolchain: ${{ env.RUST_TOOLCHAIN }} - name: Setup Node.js uses: actions/setup-node@v1 with: node-version: ${{ env.NODE_VERSION }} - uses: Swatinem/rust-cache@v2 with: workspaces: | AppFlowy-Cloud - name: Install wasm-pack run: cargo install wasm-pack - name: Build with wasm-pack run: wasm-pack build --release working-directory: ${{ github.event.inputs.working_directory }} - name: Update name working-directory: ${{ github.event.inputs.working_directory }}/pkg run: | jq '.name = "${{ github.event.inputs.package_name }}"' package.json > package.json.tmp mv package.json.tmp package.json - name: Update version working-directory: ${{ github.event.inputs.working_directory }}/pkg run: | npm version ${{ github.event.inputs.package_version }} - name: Configure npm for wasm-pack run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ${{ github.event.inputs.working_directory }}/pkg/.npmrc - name: Publish package run: | npm config set access public wasm-pack publish working-directory: ${{ github.event.inputs.working_directory }}/pkg env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}