nylas-nodejs SDK release
Automate everything up to npm publish and GitHub Release creation after merge, with explicit human checkpoints for publishing and confirmation.
Principles
- Never commit or paste npm tokens,
.npmrcsecrets, or session credentials. Publishing usesnpm loginon the maintainer’s machine only. - Release branch name:
vX.Y.Z-release(example:v8.0.5-release). - CHANGELOG follows Keep a Changelog at repo root:
CHANGELOG.md. - Traceability: Each changelog line should reference the relevant PR, commit(s), and closed issues where applicable (see PR description template below).
When the user starts a release
Ask for (if not already given):
- Target semver
X.Y.Z(no leadingvin the version number forpackage.json). - Release date for the changelog (ISO-style:
YYYY-MM-DD). - Whether this is latest or canary (see reference.md for canary/dist-tag).
Phase 1 — Branch and changelog (agent)
- Ensure work is based on
mainwith intended changes already merged (or document what is included). - Create and checkout
vX.Y.Z-releasefrommain:git fetch origin main && git checkout -b vX.Y.Z-release origin/main
- CHANGELOG.md:
- If there is an
## [Unreleased]section: rename it to## [X.Y.Z] - YYYY-MM-DDand fill sections (Added / Changed / Fixed / Breaking change, etc.). - If there is no Unreleased section: add a new top section after the intro paragraphs:
## [X.Y.Z] - YYYY-MM-DD
- Match existing style (see recent entries in
CHANGELOG.md). - For each bullet, include PR/issue links like
([#NNN](https://github.com/nylas/nylas-nodejs/pull/NNN))where possible.
- If there is an
- Commit:
chore(release): prepare vX.Y.Z(or team convention). - Push the branch:
git push -u origin vX.Y.Z-release.
Stop and show the user: branch name, diff summary, and the new changelog section.
Phase 2 — Version, tag, PR (agent; user may need to run commands locally)
- Pre-flight before
npm run build/ publish: Confirm there are no test files undersrc/that would ship in the package (team rule). - Run
npm version X.Y.Z(semver only; novprefix in the command argument).- This bumps
package.json, runs theversionlifecycle script (export-versionupdatessrc/version.tsfor the User-Agent), creates a commit, and a git tagvX.Y.Z(default npm tag prefix).
- This bumps
- Push branch and tags:
git push origin vX.Y.Z-releasegit push origin vX.Y.Z(orgit push origin --tagsif that is the team norm—prefer pushing the explicit tag to avoid stray tags).
Open a PR vX.Y.Z-release → main with this description template:
## Release vX.Y.Z (YYYY-MM-DD)
### Changelog
[Paste the full `## [X.Y.Z] - YYYY-MM-DD` section from CHANGELOG.md]
### References
For each line above, link the implementing commits and closed issues (example pattern):
- **Summary of the change** — commit `abc1234` / PR #123 / closes #456 …
(Add community / contributor credits if applicable.)
Ask the user to wait for CI green on the PR.
- After CI passes, run
npm run buildon the release branch to validate the artifact locally.
Checkpoint — npm publish (maintainer only)
Tell the user clearly:
- Publishing requires npm credentials with publish rights, configured via
npm loginon their machine (see reference.md for prerequisites). Do not store secrets in the repo. - They should run
npm publish(ornpm publish --tag canaryfor canary) from the clean release branch after CI passes and build is verified. - They should verify the package on npm when done.
Wait until the user explicitly confirms both:
- npm: “The package is published (and dist-tag is correct).”
- Git: “The release PR is merged to
main.”
Do not create the GitHub Release until both are confirmed.
Phase 3 — GitHub Release (agent, after confirmation)
Only after the user confirms published + PR merged:
- Ensure local
mainis up to date:git fetch origin main && git checkout main && git pull origin main. - Verify tag
vX.Y.Zexists on the remote (merged release flow should have the tag fromnpm version; if not, stop and ask). - Create the GitHub Release from tag
vX.Y.Zwith:- Title:
vX.Y.Z(ornylas vX.Y.Zto match past releases). - Body: Same changelog content and PR/issue/commit references as the merged PR; tag community contributors for credit when applicable.
- Title:
Prefer the gh CLI when available:
gh release create "vX.Y.Z" --title "vX.Y.Z" --notes-file - <<'EOF'
<Paste release notes; same as PR/changelog>
EOF
If gh is not available, give exact GitHub UI steps: Repository → Releases → Draft a new release → choose tag vX.Y.Z → paste notes.
Copy-paste checklist
Track progress in the chat:
Phase 1 — Prep
- [ ] Branch vX.Y.Z-release from main
- [ ] CHANGELOG [X.Y.Z] section complete with links
- [ ] Pushed branch
Phase 2 — Version & PR
- [ ] No stray tests under src/
- [ ] npm version X.Y.Z (version.ts + tag)
- [ ] Pushed branch + tag
- [ ] PR opened with changelog + references
- [ ] CI green; npm run build OK
- [ ] User ran npm publish (or canary)
- [ ] User confirmed published + PR merged
Phase 3 — GitHub
- [ ] gh release create (or UI) from vX.Y.Z with full notes
Additional topics
- Canary releases, promoting
latest, and verifying npm: reference.md - Example release PR style: https://github.com/nylas/nylas-nodejs/pull/590
Source: nylas/nylas-nodejs — distributed by TomeVault.