Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Publish

on:
release:
types:
- published

permissions:
contents: read
id-token: write

jobs:
publish:
name: Publish package to npm
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5

- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 22
registry-url: https://registry.npmjs.org
cache: npm

- name: Install dependencies
run: npm ci

- name: Verify release tag matches package version
run: |
node --input-type=module -e "
import { readFileSync } from 'node:fs';
const pkg = JSON.parse(readFileSync('package.json', 'utf8'));
const expected = 'v' + pkg.version;
const actual = process.env.RELEASE_TAG;
if (actual !== expected) {
console.error('Release tag mismatch:', { actual, expected });
process.exit(1);
}
"
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}

- name: Build
run: npm run build

- name: Test
run: npm test

- name: Select npm dist-tag
id: publish_meta
run: |
VERSION=$(node -p "JSON.parse(require('node:fs').readFileSync('package.json', 'utf8')).version")
if [[ "$VERSION" == *-* ]]; then
echo "dist_tag=next" >> "$GITHUB_OUTPUT"
echo "publish_args=--provenance --tag next" >> "$GITHUB_OUTPUT"
else
echo "dist_tag=latest" >> "$GITHUB_OUTPUT"
echo "publish_args=--provenance" >> "$GITHUB_OUTPUT"
fi

- name: Publish to npm
run: npm publish ${{ steps.publish_meta.outputs.publish_args }}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-devtool-cli",
"version": "0.1.34",
"version": "0.1.35-rc.0",
"description": "Agent-first CLI for React component tree inspection, snapshot-aware node debugging, and profiler analysis through a Playwright-managed browser session.",
"license": "MIT",
"type": "module",
Expand Down
Loading