Skip to content

Commit b553c0f

Browse files
committed
ci: rename to npm-publish.yml with dry-run toggle
- Rename check-npm-auth.yml → npm-publish.yml - Add dry_run input (default: true for safety) - Run tests before publish - Uses Trusted Publishers (OIDC) + provenance
1 parent 5c07126 commit b553c0f

File tree

2 files changed

+57
-57
lines changed

2 files changed

+57
-57
lines changed

.github/workflows/check-npm-auth.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

.github/workflows/npm-publish.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Publish to npm
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
dry_run:
7+
type: boolean
8+
default: true
9+
description: 'Dry-run (test without publishing)'
10+
11+
# Required for OIDC token exchange with npm (Trusted Publishers)
12+
permissions:
13+
contents: read
14+
id-token: write
15+
16+
jobs:
17+
publish:
18+
runs-on: ubuntu-latest
19+
environment: npm-publish
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- uses: actions/setup-node@v4
25+
with:
26+
node-version: 22
27+
registry-url: 'https://registry.npmjs.org'
28+
29+
- name: Build package
30+
working-directory: src
31+
run: |
32+
npm ci
33+
npm run build
34+
npm test
35+
36+
- name: Publish to npm (dry-run)
37+
if: ${{ inputs.dry_run }}
38+
working-directory: src/dist
39+
run: |
40+
echo "🧪 DRY-RUN MODE"
41+
echo "==============="
42+
echo ""
43+
npm publish --provenance --dry-run
44+
echo ""
45+
echo "✅ Dry-run successful! Package is ready to publish."
46+
echo " To publish for real, run this workflow again with dry_run unchecked."
47+
48+
- name: Publish to npm
49+
if: ${{ !inputs.dry_run }}
50+
working-directory: src/dist
51+
run: |
52+
echo "🚀 PUBLISHING TO NPM"
53+
echo "===================="
54+
echo ""
55+
npm publish --provenance
56+
echo ""
57+
echo "✅ Published successfully with provenance!"

0 commit comments

Comments
 (0)