You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d656d16
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: AGENTS.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,4 +30,4 @@ These steps must pass before you submit your PR.
30
30
31
31
## Publishing
32
32
33
-
Before preparing or running a release, read [Publishing NPM package for the first time](CONTRIBUTING.md#publishing-npm-package-for-the-first-time) for new package bootstrap, [Publishing SDK packages](CONTRIBUTING.md#publishing-sdk-packages)and, for custom enrichment, [Publishing the custom enrichment browser plugin](CONTRIBUTING.md#publishing-the-custom-enrichment-browser-plugin). These are the repository's maintainer runbooks. Browser must keep an exact published npm pin for custom enrichment; do not replace it with `workspace:*`. The runbook explains the source/version mismatch this prevents and the required Browser adoption PR.
33
+
Before preparing or running a release, read [Publishing NPM package for the first time](CONTRIBUTING.md#publishing-npm-package-for-the-first-time) for new package bootstrap and [Publishing SDK packages](CONTRIBUTING.md#publishing-sdk-packages) for the SDK release process.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+1-40Lines changed: 1 addition & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -106,46 +106,7 @@ To publish a package for the first time (administrators only):
106
106
107
107
For a normal stable SDK release, open **GitHub Actions → Publish v2.x → Run workflow**, select `main` (or the intended `hotfix/*` branch), explicitly select `releaseType: release`, leave the optional `branch` input empty, and leave `skipLernaVersion` unchecked. The default release type is `prerelease`, so check this input before dispatching. The workflow requires repository write/admin permission and the configured release environments and credentials.
108
108
109
-
This workflow validates, versions, and publishes SDK packages. It excludes custom enrichment, which uses the separate procedure below. The first-time bootstrap procedure above is only for a package name that does not yet exist on npm. Do not use it for a new version of an existing package.
110
-
111
-
#### Publishing the custom enrichment browser plugin
112
-
113
-
This is the maintainer runbook for `@amplitude/plugin-custom-enrichment-browser`; no Linear ticket or external project document is needed to follow it. Use the existing [Publish custom enrichment workflow](.github/workflows/publish-custom-enrichment.yml), then a separate Browser adoption PR, then [Publish v2.x](.github/workflows/publish-v2.yml).
114
-
115
-
The plugin's repository manifest is private so Lerna skips its version and dependency updates. Recursive SDK publishing explicitly excludes it. Only the temporary staged artifact has `private` removed. Do not remove `private` from the source manifest or use the generic single-package publisher to bypass this release path.
116
-
117
-
**One-time prerequisites:** the plugin is declared as dual-use, and its npm Trusted Publisher must use `.github/workflows/publish-custom-enrichment.yml`, **stage-only** permission, and the `npm-release` environment. The workflow uses the existing release GitHub App in `npm-release` for protected-branch writes. An npm maintainer with 2FA must approve each new staged version. These settings require the appropriate npm/GitHub permissions; local build success does not establish that they are configured.
118
-
119
-
1.**Prepare and merge the plugin changes.** Update the plugin source and tests, and optionally add reviewed changelog notes for the intended stable version in `packages/plugin-custom-enrichment-browser/CHANGELOG.md`. Merge to `main` or the intended `hotfix/*` branch. Keep Browser's plugin dependency at its previous published version. The plugin's version is not bumped by routine Lerna releases; the independent workflow sets it in step 2. Review any changes to its `analytics-core` peer range rather than automatically widening it.
120
-
121
-
2. **Release, stage, approve, and verify the plugin.** In GitHub Actions, run **Publish custom enrichment** from that branch and enter the exact stable version to release. The workflow updates only the plugin version and changelog, preserving reviewed notes for that version or generating notes from plugin commits. It builds, tests, and lints the plugin and its workspace dependencies using pnpm 11 on Node 24, pushes a `chore(release): publish` commit and package-specific tag together, stages the plugin, and creates a GitHub Release using those changelog notes. Follow the workflow summary to npmjs.com's **Staged Packages** tab, where an npm maintainer reviews the staged package and approves it with 2FA. No further GitHub Actions confirmation is required. Confirm the version is live on the npm package page linked in the summary, or with `pnpm view @amplitude/plugin-custom-enrichment-browser@<version> version`, replacing `<version>` with the intended version. Staging success is not publication success; continue only when npm returns the intended version.
122
-
123
-
3.**Manually create and merge the Browser adoption PR.** After npm publication, update `dependencies["@amplitude/plugin-custom-enrichment-browser"]` in `packages/analytics-browser/package.json` to that exact published version, for example `"1.0.0"`. Do not use `workspace:*`, `^1.0.0`, or `~1.0.0`. Run `pnpm install` from the repository root, review and commit `pnpm-lock.yaml`, and verify a frozen-lockfile install succeeds. Replace any plugin changelog `pending publication` label with the actual npm publication date. Validate Browser-only installation, direct-plugin installation with compatible core, TypeScript resolution, and the repository checks before merging. This PR changes Browser's dependency on the plugin; it does not manually bump Browser's own version. Repeat this adoption step whenever Browser should consume a newer plugin release.
124
-
125
-
4.**Publish Browser with Publish v2.x.** After the adoption PR merges, follow the normal stable SDK release instructions above. Publish v2 checks that Browser's pinned plugin version exists on npm, then versions and publishes SDK packages while excluding custom enrichment. Verify that the resulting Browser package declares the intended exact plugin dependency. If the plugin is still staged, finish npm approval and verification before retrying; do not bypass the check. Publishing Browser first can make consumer installations fail because its dependency is unavailable.
126
-
127
-
Browser may continue releasing with its previous published plugin pin while a newer plugin version is pending. Publishing a plugin and adopting it in Browser are separate decisions; a plugin release does not automatically update Browser.
128
-
129
-
##### Why Browser uses an exact npm pin instead of `workspace:*`
130
-
131
-
The manual adoption PR is an intentional boundary between published plugin code and ongoing plugin development. Consider this example:
132
-
133
-
- Plugin `1.0.0` containing **code A** is published on npm.
134
-
- Someone changes the repository's plugin source to **code B**, but its package.json still says `1.0.0`.
135
-
- With `workspace:*`, Browser builds against the local workspace plugin, so code B can enter its browser bundle.
136
-
- pnpm converts `workspace:*` to the local version number when packing Browser. The published manifest would still declare `1.0.0`, which resolves to code A on npm, even though the bundle may contain code B.
137
-
138
-
Checking that npm has `1.0.0` does not catch this mismatch: it checks availability, not equality between workspace source and the published artifact. Approving a staged package later does not repair a Browser bundle that has already shipped.
139
-
140
-
With an exact npm pin and the committed lockfile, the repository's normal dependency installation resolves Browser's plugin from the published npm artifact. Unreleased workspace plugin edits do not automatically become Browser's dependency. The follow-up PR selects the published version and provides a review and compatibility check before Browser adopts it. Do not replace this pin with a workspace dependency as a convenience refactor, or use local links/overrides in release validation that bypass it. This restriction concerns Browser's dependency on the plugin; the plugin may still use workspace core as a development dependency.
141
-
142
-
##### Compatibility, release records, and retries
143
-
144
-
Plugin 1.0.0 was published on 2026-10-21. It deliberately introduced a breaking dependency change for direct plugin consumers: they must declare compatible `@amplitude/analytics-core` themselves. Browser-only consumers do not need a separate core declaration because Browser supplies it. The stable peer range `^2.61.0` does not cover arbitrary core prereleases; review those separately before an SDK prerelease. See the [plugin README](packages/plugin-custom-enrichment-browser/README.md) for consumer installation instructions.
145
-
146
-
The independent workflow currently releases stable versions only. It creates the plugin's version/changelog update, release commit, package-specific Git tag, and GitHub Release without running Lerna or publishing other SDK packages. Plugin 1.0.0 predates this automation: it was published from `e0866041ef2ff19209d619c1a43116c27eaa6fc6`, and its publication date is recorded in the plugin changelog. Any separate historical tag or GitHub Release for 1.0.0 must reference that actual published source commit.
147
-
148
-
Retry with the same version to reuse the workflow-created release commit and tag; a completed release is not recreated. If only the GitHub Release job fails, use **Re-run failed jobs** to retry it without staging again. If staging succeeded but its result was interrupted, approve the existing stage on npm before retrying the same version. A version already on npm without a matching workflow-created tag is rejected rather than attaching it to unrelated source. A concurrent branch update stops the push without overwriting other work. For changed plugin code, prepare a new version; rerunning an already-published version does not publish those changes. Keep the type-only core import CI guard: this peer-dependency arrangement does not itself reduce the bundle or guarantee one core instance across every application dependency graph.
109
+
This workflow validates, versions, and publishes SDK packages. The first-time bootstrap procedure above is only for a package name that does not yet exist on npm. Do not use it for a new version of an existing package.
149
110
150
111
#### Recovering a partial `publish-v2` workflow run
0 commit comments