Skip to content

Commit 7db0ce9

Browse files
authored
Update RELEASING.md on how to rotate npm tokens (#1330)
1 parent 1a49fd1 commit 7db0ce9

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

RELEASING.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,42 @@ yarn release
8080
Feature branches are automatically released under:
8181

8282
- `http://cdn.segment.com/analytics-next/br/<branch>/<latest|sha>/standalone.js.gz`
83+
84+
## NPM Token Management
85+
86+
### How to Rotate/Update NPM Tokens
87+
88+
The repository uses an NPM token stored in GitHub Actions secrets (`NPM_TOKEN`) to publish packages automatically. Due to npm's security updates, tokens now have a maximum 90-day lifetime and classic tokens will be revoked. You should use **Granular Access Tokens** for better security.
89+
90+
#### Creating a New NPM Token
91+
92+
1. **Generate a new token at npm**:
93+
- Go to https://www.npmjs.com/settings/YOUR_USERNAME/tokens
94+
- Click "Generate New Token" → "Granular Access Token"
95+
- Configure the token:
96+
- **Token Name**: Something descriptive like "analytics-next-ci"
97+
- **Expiration**: 90 days (maximum)
98+
- **Permissions**: Select "Read and write"
99+
- **Packages and scopes**: Select packages in `@segment` organization
100+
- Copy the token (starts with `npm_`)
101+
102+
2. **Test the token locally**:
103+
```bash
104+
# Add token to your ~/.npmrc
105+
echo "//registry.npmjs.org/:_authToken=YOUR_NEW_TOKEN" > ~/.npmrc
106+
107+
# Verify authentication
108+
npm whoami
109+
110+
# Build packages
111+
yarn build
112+
113+
# Test dry-run publish (doesn't actually publish)
114+
cd packages/core && npm publish --dry-run
115+
cd ../browser && npm publish --dry-run
116+
cd ../node && npm publish --dry-run
117+
```
118+
119+
3. **Update GitHub Actions Secret**:
120+
- Go to: https://github.com/segmentio/analytics-next/settings/secrets/actions
121+
- Update secret for `NPM_TOKEN`

0 commit comments

Comments
 (0)