v0.2.21: sync from monorepo 2026-06-04 #33
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: | |
| push: | |
| branches: [main] | |
| concurrency: | |
| group: publish | |
| cancel-in-progress: false | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write # OIDC trusted publishing — authenticates to npm without a long-lived token | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org | |
| # Trusted publishing (OIDC) requires npm >= 11.5.1; Node 20 ships npm 10. | |
| - run: npm install -g npm@latest | |
| - run: pnpm install --no-frozen-lockfile | |
| - run: pnpm build | |
| - name: Publish if version is new | |
| run: | | |
| PACKAGE_NAME=$(node -p "require('./package.json').name") | |
| LOCAL_VER=$(node -p "require('./package.json').version") | |
| NPM_VER=$(npm view "$PACKAGE_NAME" version 2>/dev/null || echo "0.0.0") | |
| if [ "$LOCAL_VER" = "$NPM_VER" ]; then | |
| echo "v$LOCAL_VER already on npm — skipping" | |
| else | |
| npm publish --access public | |
| echo "Published $PACKAGE_NAME@$LOCAL_VER" | |
| fi |