1.0.2 #1
Workflow file for this run
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: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Node 24 includes npm 11.5.1+ (required for Trusted Publishing). | |
| # Avoid registry-url: it writes always-auth + empty _authToken and | |
| # npm then skips OIDC (misleading E404 / ENEEDAUTH). | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: npm | |
| - name: Show Node / npm versions | |
| run: | | |
| node -v | |
| npm -v | |
| - run: npm ci | |
| - run: npm test | |
| - name: Verify tag matches package.json version | |
| run: | | |
| TAG="${GITHUB_REF_NAME#v}" | |
| PKG="$(node -p "require('./package.json').version")" | |
| if [ "$TAG" != "$PKG" ]; then | |
| echo "Tag version ($TAG) does not match package.json version ($PKG)" | |
| exit 1 | |
| fi | |
| - name: Clear token auth so npm uses OIDC | |
| run: | | |
| unset NODE_AUTH_TOKEN NPM_TOKEN || true | |
| # Remove any auth lines setup-node / env may have left behind. | |
| for f in "$RUNNER_TEMP/.npmrc" "$HOME/.npmrc" .npmrc; do | |
| if [ -f "$f" ]; then | |
| echo "Scrubbing $f" | |
| sed -i '/_authToken/d; /always-auth/d' "$f" || true | |
| cat "$f" || true | |
| fi | |
| done | |
| npm config delete //registry.npmjs.org/:_authToken || true | |
| npm config list | |
| # Trusted Publisher must match OIDC claims exactly (case-sensitive): | |
| # Repository: ONLYHUMN/chrome-console-log-mcp-server | |
| # Workflow: publish.yml | |
| # Environment: (blank) | |
| - run: npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: '' | |
| NPM_TOKEN: '' |