Merge pull request #72 from heygen-com/fix/cli-publish-name

fix(ci): rename CLI package to match npm and make publish idempotent
This commit is contained in:
James Russo
2026-03-26 15:44:51 -07:00
committed by GitHub
2 changed files with 65 additions and 33 deletions
+60 -28
View File
@@ -27,43 +27,75 @@ jobs:
- run: bun run build
- run: bun run verify:packed-manifests
- name: Publish @hyperframes/core
continue-on-error: true
run: pnpm --filter @hyperframes/core publish --access public --no-git-checks
- name: Publish packages
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
VERSION="${GITHUB_REF_NAME#v}"
FAILED=0
- name: Publish @hyperframes/engine
continue-on-error: true
run: pnpm --filter @hyperframes/engine publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publish_pkg() {
local filter="$1"
local name="$2"
- name: Publish @hyperframes/producer
continue-on-error: true
run: pnpm --filter @hyperframes/producer publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Check if this version is already published
if npm view "${name}@${VERSION}" version >/dev/null 2>&1; then
echo "⏭️ ${name}@${VERSION} already published — skipping"
return 0
fi
- name: Publish @hyperframes/studio
continue-on-error: true
run: pnpm --filter @hyperframes/studio publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
echo "📦 Publishing ${name}@${VERSION}..."
if pnpm --filter "$filter" publish --access public --no-git-checks; then
echo "✅ ${name}@${VERSION} published"
else
echo "❌ ${name}@${VERSION} failed to publish"
FAILED=1
fi
}
- name: Publish hyperframes (CLI)
continue-on-error: true
run: pnpm --filter @hyperframes/cli publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publish_pkg "@hyperframes/core" "@hyperframes/core"
publish_pkg "@hyperframes/engine" "@hyperframes/engine"
publish_pkg "@hyperframes/producer" "@hyperframes/producer"
publish_pkg "@hyperframes/studio" "@hyperframes/studio"
# CLI is @hyperframes/cli in the monorepo but published as unscoped "hyperframes" on npm.
# Rewrite the name in package.json before publishing, then use npm publish directly
# since pnpm --filter won't match the rewritten name.
if npm view "hyperframes@${VERSION}" version >/dev/null 2>&1; then
echo "⏭️ hyperframes@${VERSION} already published — skipping"
else
node -e "
const fs = require('fs');
const p = 'packages/cli/package.json';
const pkg = JSON.parse(fs.readFileSync(p, 'utf8'));
pkg.name = 'hyperframes';
fs.writeFileSync(p, JSON.stringify(pkg, null, 2) + '\n');
"
echo "📦 Publishing hyperframes@${VERSION}..."
if (cd packages/cli && npm publish --access public); then
echo "✅ hyperframes@${VERSION} published"
else
echo "❌ hyperframes@${VERSION} failed to publish"
FAILED=1
fi
fi
if [ "$FAILED" -ne 0 ]; then
echo "::error::One or more packages failed to publish"
exit 1
fi
- name: Create GitHub Release
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${GITHUB_REF_NAME#v}"
gh release create "v${VERSION}" \
--repo "${{ github.repository }}" \
--title "v${VERSION}" \
--generate-notes
# Skip if release already exists (idempotent re-runs)
if gh release view "v${VERSION}" --repo "${{ github.repository }}" >/dev/null 2>&1; then
echo "Release v${VERSION} already exists — skipping"
else
gh release create "v${VERSION}" \
--repo "${{ github.repository }}" \
--title "v${VERSION}" \
--generate-notes
fi
+5 -5
View File
@@ -19,7 +19,7 @@
},
"packages/cli": {
"name": "@hyperframes/cli",
"version": "0.1.2",
"version": "0.1.4",
"bin": {
"hyperframes": "./dist/cli.js",
},
@@ -57,7 +57,7 @@
},
"packages/core": {
"name": "@hyperframes/core",
"version": "0.1.2",
"version": "0.1.4",
"devDependencies": {
"@types/jsdom": "^28.0.0",
"@types/node": "^24.10.13",
@@ -74,7 +74,7 @@
},
"packages/engine": {
"name": "@hyperframes/engine",
"version": "0.1.2",
"version": "0.1.4",
"dependencies": {
"@hono/node-server": "^1.13.0",
"@hyperframes/core": "workspace:^",
@@ -91,7 +91,7 @@
},
"packages/producer": {
"name": "@hyperframes/producer",
"version": "0.1.2",
"version": "0.1.4",
"dependencies": {
"@fontsource/archivo-black": "^5.2.8",
"@fontsource/eb-garamond": "^5.2.7",
@@ -121,7 +121,7 @@
},
"packages/studio": {
"name": "@hyperframes/studio",
"version": "0.1.2",
"version": "0.1.4",
"dependencies": {
"@codemirror/autocomplete": "^6.20.1",
"@codemirror/commands": "^6.10.3",