@@ -137,15 +137,40 @@ describe('MyComponent', () => {
137137
138138## 📦 Publishing
139139
140- ### Setup npm Publishing
140+ ### Setup Automated Publishing with OIDC (Recommended)
141141
142- 1 . Add ` NPM_TOKEN ` to GitHub repository secrets
143- 2 . Update version in ` package.json `
144- 3 . Create a GitHub release
145- 4 . Automated workflow publishes to npm
142+ This template is configured to publish to npm using OpenID Connect (OIDC), which is more secure than using long-lived NPM tokens.
143+
144+ ** Initial Setup:**
145+
146+ 1 . Publish your package to npm manually the first time:
147+ ``` bash
148+ npm run test:run # Ensure tests pass
149+ npm run lint # Ensure code is clean
150+ npm publish # First publish must be manual
151+ ```
152+
153+ 2 . Configure OIDC on npm:
154+ - Visit your package's access page: ` https://www.npmjs.com/package/@yourscope/your-component-name/access `
155+ - Under "Publishing Access", click "Configure OIDC"
156+ - Add GitHub Actions as a trusted publisher with these settings:
157+ - ** Provider** : GitHub
158+ - ** Organization/Username** : Your GitHub username or organization
159+ - ** Repository** : Your repository name
160+ - ** Workflow** : ` .github/workflows/publish.yml `
161+ - ** Environment** : Leave blank (unless you use GitHub environments)
162+
163+ 3 . Create a GitHub release to trigger automated publishing:
164+ - Use ` npm version ` to update version and create a tag: ` npm version patch ` (or ` minor ` /` major ` )
165+ - Push with tags: ` git push --follow-tags `
166+ - Or create a release through GitHub's UI
167+
168+ The GitHub Actions workflow (` .github/workflows/publish.yml ` ) will automatically publish to npm when you create a new version tag.
146169
147170### Manual Publishing
148171
172+ If you prefer to publish manually without automation:
173+
149174``` bash
150175npm run test:run # Ensure tests pass
151176npm run lint # Ensure code is clean
0 commit comments