Publish to npm #15
This file contains hidden or 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: Publish to npm | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v1 | |
| with: | |
| bun-version: latest | |
| - name: Install pnpm | |
| run: | | |
| npm install -g pnpm@latest | |
| - name: Install dependencies | |
| run: pnpm install --no-frozen-lockfile | |
| - name: Install SDK dependencies | |
| run: | | |
| cd sdk | |
| pnpm install | |
| - name: Build SDK | |
| run: | | |
| pnpm --filter @open-web3/pvq build | |
| ls -la sdk/dist/ | |
| - name: Check NPM_TOKEN | |
| run: | | |
| if [ -z "${{ secrets.NPM_TOKEN }}" ]; then | |
| echo "❌ NPM_TOKEN is not set" | |
| exit 1 | |
| else | |
| echo "✅ NPM_TOKEN is set" | |
| fi | |
| - name: Publish to npm | |
| run: | | |
| cd sdk | |
| echo "Publishing version: $(node -p "require('./package.json').version")" | |
| npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish success | |
| run: | | |
| echo "✅ Successfully published @open-web3/pvq@$(node -p "require('./sdk/package.json').version")" |