|
2 | 2 |
|
3 | 3 | The seven publishable libraries (`@threadplane/chat`, `@threadplane/langgraph`, `@threadplane/ag-ui`, `@threadplane/render`, `@threadplane/a2ui`, `@threadplane/licensing`, `@threadplane/telemetry`) ship together at a synchronized version via Nx Release. During the `0.0.x` exploratory phase, only patch bumps are used. |
4 | 4 |
|
5 | | -## One-shot release (recommended; second release onward) |
| 5 | +## Standard release (second release onward) |
6 | 6 |
|
7 | 7 | > First release? See **[First `@threadplane` release](#first-threadplane-release)** below — the flow is different because there's no prior package under the new npm org yet. |
8 | 8 |
|
| 9 | +> [!WARNING] |
| 10 | +> **Do not use `nx release patch`.** The one-shot `nx release` command does not |
| 11 | +> work in this repo. `nx.json` configures git options under |
| 12 | +> `release.changelog.git`, and Nx rejects the top-level command whenever |
| 13 | +> granular git config is present: |
| 14 | +> |
| 15 | +> `NX The "release" top level command cannot be used with granular git configuration.` |
| 16 | +> |
| 17 | +> Use the subcommands below instead. |
| 18 | +
|
9 | 19 | From a clean main branch: |
10 | 20 |
|
11 | 21 | ```bash |
12 | 22 | git checkout main && git pull |
13 | | -npx nx release patch |
14 | | -``` |
15 | 23 |
|
16 | | -This runs Nx Release in interactive mode, which: |
17 | | - |
18 | | -1. Builds all seven publishable projects and patches install telemetry into the publishable package manifests (preVersionCommand). |
19 | | -2. Bumps every package.json version (e.g., `0.0.1` → `0.0.2`). |
20 | | -3. Generates `CHANGELOG.md` from commits since the last tag. |
21 | | -4. Creates a git commit `chore(release): publish v0.0.2`. |
22 | | -5. Tags the commit `v0.0.2`. |
23 | | -6. **Prompts for confirmation, then publishes to npm with provenance.** |
| 24 | +# 1. Version bump. Runs preVersionCommand (builds all seven projects and |
| 25 | +# patches install telemetry into the dist manifests), rewrites every |
| 26 | +# package.json, updates package-lock.json, and stages the result. |
| 27 | +npx nx release version --specifier=patch |
24 | 28 |
|
25 | | -After the prompt, push the commit and tag: |
| 29 | +# 2. Changelog + commit + tag + GitHub Release. |
| 30 | +# Pass the BARE version — see the warning below. |
| 31 | +npx nx release changelog 0.0.57 |
26 | 32 |
|
27 | | -```bash |
| 33 | +# 3. Push. The Publish workflow fires on the tag and publishes to npm |
| 34 | +# with provenance via OIDC trusted publishing. |
28 | 35 | git push origin main --tags |
29 | 36 | ``` |
30 | 37 |
|
31 | | -The `Publish` GitHub Actions workflow fires on tag push and re-publishes (idempotent — npm rejects duplicate versions). |
32 | | - |
33 | | -## Step-by-step (for debugging) |
| 38 | +> [!WARNING] |
| 39 | +> **Pass the bare version to `changelog`, not `vX.Y.Z`.** `releaseTagPattern` is |
| 40 | +> `v{version}`, so Nx prepends the `v` itself. Passing `v0.0.57` produces a |
| 41 | +> malformed **`vv0.0.57`** tag and a GitHub Release at |
| 42 | +> `/releases/tag/vv0.0.57`. Pass `0.0.57`. |
| 43 | +> |
| 44 | +> Always `--dry-run` step 2 first and check the printed tag URL before |
| 45 | +> committing to it. |
34 | 46 |
|
35 | | -If something goes wrong, run the steps individually: |
| 47 | +Step 3 is what actually ships. You can also publish from your machine with |
| 48 | +`npx nx release publish --groups=publishable`, but preferring the tag-driven |
| 49 | +workflow means no local npm credentials are needed and provenance is attested |
| 50 | +by CI. |
36 | 51 |
|
37 | | -```bash |
38 | | -# 1. Version bump (writes new versions to package.json files) |
39 | | -npx nx release version --specifier=patch |
| 52 | +### Check the lockfile before pushing |
40 | 53 |
|
41 | | -# 2. Generate changelog (creates CHANGELOG.md, commits, tags) |
42 | | -npx nx release changelog v0.0.2 # use the version produced by step 1 |
| 54 | +Step 1 regenerates `package-lock.json`. On macOS that can drop the Linux |
| 55 | +`@next/swc-*` bindings and break CI. The diff should be **only** the version |
| 56 | +lines for the seven libs: |
43 | 57 |
|
44 | | -# 3. Publish to npm |
45 | | -npx nx release publish --groups=publishable |
| 58 | +```bash |
| 59 | +git diff --cached package-lock.json | grep -E '^-' | grep -icE 'linux|darwin|musl|gnu' |
| 60 | +# must print 0 |
46 | 61 | ``` |
47 | 62 |
|
| 63 | +If it prints anything else, revert the lockfile and re-apply the version lines by hand. |
| 64 | + |
48 | 65 | ## First `@threadplane` release |
49 | 66 |
|
50 | 67 | The first publish under the `@threadplane` npm org is manual. The packages must exist on npm before trusted publishing can be configured package-by-package. Run this from a clean, merged `main` branch. |
@@ -87,13 +104,27 @@ After the first `@threadplane` release, configure npm trusted publishing for all |
87 | 104 |
|
88 | 105 | ## Dry run |
89 | 106 |
|
90 | | -Always sanity-check before a real release: |
| 107 | +Always sanity-check before a real release. Dry-run each subcommand — the |
| 108 | +one-shot `nx release patch --dry-run` fails the same way the real command does: |
| 109 | + |
| 110 | +```bash |
| 111 | +npx nx release version --specifier=patch --dry-run |
| 112 | +npx nx release changelog 0.0.57 --dry-run # bare version; check the printed tag URL |
| 113 | +``` |
| 114 | + |
| 115 | +These print what would happen without modifying anything. |
| 116 | + |
| 117 | +## Is a release actually needed? |
| 118 | + |
| 119 | +Version bumps on `main` do **not** publish — only a pushed `vX.Y.Z` tag does. Main |
| 120 | +routinely drifts ahead of npm, and the version on disk can match the version on |
| 121 | +npm while the code differs. Check before assuming: |
91 | 122 |
|
92 | 123 | ```bash |
93 | | -npx nx release patch --dry-run |
| 124 | +git rev-list --count "v$(npm view @threadplane/chat version)"..origin/main |
94 | 125 | ``` |
95 | 126 |
|
96 | | -This prints what would happen without modifying anything. |
| 127 | +Anything above `0` means main has unpublished commits. |
97 | 128 |
|
98 | 129 | ## Manual workflow trigger |
99 | 130 |
|
|
0 commit comments