diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 73b5476..06b86d5 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -123,34 +123,44 @@ jobs: cd cli/src cargo publish --token ${{ secrets.CRATESTOKEN }} - publish-wasm: - needs: build-wasm - runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/wasm-v') - steps: - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - override: true - - name: Install wasm-pack - run: cargo install wasm-pack - - name: Build wasm package - run: | - cd wasm - wasm-pack build --target bundler - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: '20.x' - registry-url: 'https://registry.npmjs.org' - token: ${{ secrets.NPM_TOKEN }} - - name: Publish to npm - run: | - cd wasm/pkg - npm ci - npm publish - - run: npm publish --provenance --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + Here are the steps to fix the publish-wasm GitHub Actions workflow: + + Ensure the checkout step is done before any build or install steps. + The npm publish step is done twice; remove the duplicate. + Add a step to install npm dependencies before publishing. + +Here is the corrected workflow: + +yaml + +publish-wasm: + needs: build-wasm + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/wasm-v') + steps: + - uses: actions/checkout@v4 + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + - name: Install wasm-pack + run: cargo install wasm-pack + - name: Build wasm package + run: | + cd wasm + wasm-pack build --target bundler + - uses: actions/setup-node@v4 + with: + node-version: '20.x' + registry-url: 'https://registry.npmjs.org' + token: ${{ secrets.NPM_TOKEN }} + - name: Install npm dependencies + run: | + cd wasm/pkg + npm ci + - name: Publish to npm + run: npm publish --provenance --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file