|
| 1 | +--- |
| 2 | +name: nylas-nodejs-release |
| 3 | +description: >- |
| 4 | + Prepares nylas-nodejs SDK releases on a versioned release branch with CHANGELOG |
| 5 | + updates, version bump, git tag, and PR body. Stops for the maintainer to run |
| 6 | + npm publish, then after confirmation creates the GitHub Release from the tag. |
| 7 | + Use when the user wants to ship a new SDK version, cut a release branch, update |
| 8 | + CHANGELOG.md, npm version, tag, open a release PR, publish to npm, or create a |
| 9 | + GitHub Release. |
| 10 | +--- |
| 11 | + |
| 12 | +# nylas-nodejs SDK release |
| 13 | + |
| 14 | +Automate **everything up to npm publish** and **GitHub Release creation after merge**, with explicit **human checkpoints** for publishing and confirmation. |
| 15 | + |
| 16 | +## Principles |
| 17 | + |
| 18 | +- **Never** commit or paste npm tokens, `.npmrc` secrets, or session credentials. Publishing uses `npm login` on the maintainer’s machine only. |
| 19 | +- **Release branch name**: `vX.Y.Z-release` (example: `v8.0.5-release`). |
| 20 | +- **CHANGELOG** follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) at repo root: `CHANGELOG.md`. |
| 21 | +- **Traceability**: Each changelog line should reference the relevant **PR**, **commit(s)**, and **closed issues** where applicable (see PR description template below). |
| 22 | + |
| 23 | +## When the user starts a release |
| 24 | + |
| 25 | +Ask for (if not already given): |
| 26 | + |
| 27 | +1. Target **semver** `X.Y.Z` (no leading `v` in the version number for `package.json`). |
| 28 | +2. **Release date** for the changelog (ISO-style: `YYYY-MM-DD`). |
| 29 | +3. Whether this is **latest** or **canary** (see [reference.md](reference.md) for canary/dist-tag). |
| 30 | + |
| 31 | +--- |
| 32 | + |
| 33 | +## Phase 1 — Branch and changelog (agent) |
| 34 | + |
| 35 | +1. Ensure work is based on **`main`** with intended changes already merged (or document what is included). |
| 36 | +2. Create and checkout **`vX.Y.Z-release`** from `main`: |
| 37 | + - `git fetch origin main && git checkout -b vX.Y.Z-release origin/main` |
| 38 | +3. **CHANGELOG.md**: |
| 39 | + - If there is an `## [Unreleased]` section: rename it to `## [X.Y.Z] - YYYY-MM-DD` and fill sections (**Added** / **Changed** / **Fixed** / **Breaking change**, etc.). |
| 40 | + - If there is no Unreleased section: add a new top section after the intro paragraphs: |
| 41 | + - `## [X.Y.Z] - YYYY-MM-DD` |
| 42 | + - Match existing style (see recent entries in `CHANGELOG.md`). |
| 43 | + - For each bullet, include PR/issue links like `([#NNN](https://github.com/nylas/nylas-nodejs/pull/NNN))` where possible. |
| 44 | +4. Commit: `chore(release): prepare vX.Y.Z` (or team convention). |
| 45 | +5. Push the branch: `git push -u origin vX.Y.Z-release`. |
| 46 | + |
| 47 | +**Stop and show** the user: branch name, diff summary, and the new changelog section. |
| 48 | + |
| 49 | +--- |
| 50 | + |
| 51 | +## Phase 2 — Version, tag, PR (agent; user may need to run commands locally) |
| 52 | + |
| 53 | +1. **Pre-flight before `npm run build` / publish**: Confirm there are **no test files** under `src/` that would ship in the package (team rule). |
| 54 | +2. Run **`npm version X.Y.Z`** (semver only; no `v` prefix in the command argument). |
| 55 | + - This bumps `package.json`, runs the `version` lifecycle script (`export-version` updates `src/version.ts` for the User-Agent), creates a **commit**, and a **git tag** `vX.Y.Z` (default npm tag prefix). |
| 56 | +3. Push branch and tags: |
| 57 | + - `git push origin vX.Y.Z-release` |
| 58 | + - `git push origin vX.Y.Z` (or `git push origin --tags` if that is the team norm—prefer pushing the explicit tag to avoid stray tags). |
| 59 | + |
| 60 | +**Open a PR** `vX.Y.Z-release` → `main` with this **description template**: |
| 61 | + |
| 62 | +```markdown |
| 63 | +## Release vX.Y.Z (YYYY-MM-DD) |
| 64 | + |
| 65 | +### Changelog |
| 66 | + |
| 67 | +[Paste the full `## [X.Y.Z] - YYYY-MM-DD` section from CHANGELOG.md] |
| 68 | + |
| 69 | +### References |
| 70 | + |
| 71 | +For each line above, link the implementing commits and closed issues (example pattern): |
| 72 | + |
| 73 | +- **Summary of the change** — commit `abc1234` / PR #123 / closes #456 … |
| 74 | + |
| 75 | +(Add community / contributor credits if applicable.) |
| 76 | +``` |
| 77 | + |
| 78 | +Ask the user to wait for **CI green** on the PR. |
| 79 | + |
| 80 | +4. After CI passes, run **`npm run build`** on the release branch to validate the artifact locally. |
| 81 | + |
| 82 | +**Checkpoint — npm publish (maintainer only)** |
| 83 | +Tell the user clearly: |
| 84 | + |
| 85 | +- Publishing requires **npm credentials** with publish rights, configured via **`npm login`** on their machine (see [reference.md](reference.md) for prerequisites). Do not store secrets in the repo. |
| 86 | +- They should run **`npm publish`** (or **`npm publish --tag canary`** for canary) from the clean release branch **after** CI passes and build is verified. |
| 87 | +- They should verify the package on npm when done. |
| 88 | + |
| 89 | +**Wait** until the user explicitly confirms both: |
| 90 | + |
| 91 | +1. **npm**: “The package is published (and dist-tag is correct).” |
| 92 | +2. **Git**: “The release PR is merged to `main`.” |
| 93 | + |
| 94 | +Do **not** create the GitHub Release until both are confirmed. |
| 95 | + |
| 96 | +--- |
| 97 | + |
| 98 | +## Phase 3 — GitHub Release (agent, after confirmation) |
| 99 | + |
| 100 | +Only after the user confirms **published + PR merged**: |
| 101 | + |
| 102 | +1. Ensure local `main` is up to date: `git fetch origin main && git checkout main && git pull origin main`. |
| 103 | +2. Verify tag `vX.Y.Z` exists on the remote (merged release flow should have the tag from `npm version`; if not, stop and ask). |
| 104 | +3. Create the GitHub Release **from tag `vX.Y.Z`** with: |
| 105 | + - **Title**: `vX.Y.Z` (or `nylas vX.Y.Z` to match past releases). |
| 106 | + - **Body**: Same changelog content and PR/issue/commit references as the merged PR; tag community contributors for credit when applicable. |
| 107 | + |
| 108 | +Prefer the **`gh` CLI** when available: |
| 109 | + |
| 110 | +```bash |
| 111 | +gh release create "vX.Y.Z" --title "vX.Y.Z" --notes-file - <<'EOF' |
| 112 | +<Paste release notes; same as PR/changelog> |
| 113 | +EOF |
| 114 | +``` |
| 115 | + |
| 116 | +If `gh` is not available, give exact **GitHub UI** steps: Repository → Releases → Draft a new release → choose tag `vX.Y.Z` → paste notes. |
| 117 | + |
| 118 | +--- |
| 119 | + |
| 120 | +## Copy-paste checklist |
| 121 | + |
| 122 | +Track progress in the chat: |
| 123 | + |
| 124 | +```text |
| 125 | +Phase 1 — Prep |
| 126 | +- [ ] Branch vX.Y.Z-release from main |
| 127 | +- [ ] CHANGELOG [X.Y.Z] section complete with links |
| 128 | +- [ ] Pushed branch |
| 129 | +
|
| 130 | +Phase 2 — Version & PR |
| 131 | +- [ ] No stray tests under src/ |
| 132 | +- [ ] npm version X.Y.Z (version.ts + tag) |
| 133 | +- [ ] Pushed branch + tag |
| 134 | +- [ ] PR opened with changelog + references |
| 135 | +- [ ] CI green; npm run build OK |
| 136 | +- [ ] User ran npm publish (or canary) |
| 137 | +- [ ] User confirmed published + PR merged |
| 138 | +
|
| 139 | +Phase 3 — GitHub |
| 140 | +- [ ] gh release create (or UI) from vX.Y.Z with full notes |
| 141 | +``` |
| 142 | + |
| 143 | +--- |
| 144 | + |
| 145 | +## Additional topics |
| 146 | + |
| 147 | +- Canary releases, promoting `latest`, and verifying npm: [reference.md](reference.md) |
| 148 | +- Example release PR style: https://github.com/nylas/nylas-nodejs/pull/590 |
0 commit comments