diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 795c4e64..eeddcb65 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -36,12 +36,23 @@ jobs: node-version: "20" registry-url: "https://registry.npmjs.org" + - name: Determine dist-tag + id: dist-tag + run: | + VERSION=$(node -p "require('./package.json').version") + if [[ "$VERSION" == *-* ]]; then + echo "tag=beta" >> "$GITHUB_OUTPUT" + else + echo "tag=latest" >> "$GITHUB_OUTPUT" + fi + echo "Publishing $VERSION with tag: $(grep tag= "$GITHUB_OUTPUT" | cut -d= -f2)" + - name: Publish - run: npm publish --provenance + run: npm publish --provenance --tag ${{ steps.dist-tag.outputs.tag }} env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Publish alias packages - run: node scripts/publish-aliases.mjs + run: node scripts/publish-aliases.mjs --dist-tag ${{ steps.dist-tag.outputs.tag }} env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 35994b0e..d48790df 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "failproofai", - "version": "0.0.2-beta.2", + "version": "0.0.2", "description": "Open-source hooks, policies, and project visualization for Claude Code & Agents SDK", "bin": { "failproofai": "./dist/cli.mjs" diff --git a/scripts/publish-aliases.mjs b/scripts/publish-aliases.mjs index 8df8410f..3d14bcd9 100644 --- a/scripts/publish-aliases.mjs +++ b/scripts/publish-aliases.mjs @@ -8,6 +8,8 @@ const __dirname = dirname(fileURLToPath(import.meta.url)); const rootPkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf8')); const VERSION = rootPkg.version; const DRY_RUN = process.argv.includes('--dry-run'); +const distTagIdx = process.argv.indexOf('--dist-tag'); +const DIST_TAG = distTagIdx !== -1 ? process.argv[distTagIdx + 1] : (VERSION.includes('-') ? 'beta' : 'latest'); const ALIASES = [ // Formatting variants — no "ai", or hyphen/underscore separators @@ -54,7 +56,7 @@ for (const name of ALIASES) { cpSync(join(__dirname, 'alias-proxy.js'), join(binDir, 'proxy.js')); if (DRY_RUN) { - console.log(`[dry-run] Would publish ${name}@${VERSION}`); + console.log(`[dry-run] Would publish ${name}@${VERSION} (tag: ${DIST_TAG})`); console.log(JSON.stringify(pkg, null, 2)); console.log('---'); rmSync(tmpDir, { recursive: true, force: true }); @@ -63,7 +65,7 @@ for (const name of ALIASES) { console.log(`Publishing ${name}@${VERSION}...`); try { - execSync('npm publish', { cwd: tmpDir, stdio: 'pipe' }); + execSync(`npm publish --tag ${DIST_TAG}`, { cwd: tmpDir, stdio: 'pipe' }); console.log(`Done: ${name}`); } catch (err) { const output = (err.stdout?.toString() ?? '') + (err.stderr?.toString() ?? '');