fix(sdk): enforce single source of truth for SDK package versioning#35110
fix(sdk): enforce single source of truth for SDK package versioning#35110
Conversation
…35109) - Add core-web/libs/sdk/VERSION as the single version source - Replace ~150 lines of fragile NPM-scanning version detection with a simple read from VERSION file - Use GITHUB_RUN_NUMBER as next tag suffix — guaranteed unique, no collision - Manual release workflow now bumps VERSION file and commits it to git - New packages added to libs/sdk/ work automatically without manual sync Fixes recurring 403 publish failures caused by packages drifting out of version sync (e.g. react at 1.2.6-next.3 while others at 1.2.5-next.7). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Claude finished @fmontes's task in 3m 43s —— View job PR Review
Bug:
|
|
Architectural concern: VERSION file on main vs release branch pattern The dotCMS release model keeps main versionless and deterministic:
This PR introduces
Alternative (aligned with existing model):
This is a design question, not a blocker — there may be good reasons the SDK model needs to differ from Maven. But worth a deliberate decision rather than drifting into a different pattern. Also from the automated review:
|
There was a problem hiding this comment.
Pull request overview
This PR enforces a single source of truth for dotCMS JavaScript SDK versioning by introducing a core-web/libs/sdk/VERSION file and simplifying the SDK publish action to derive versions from it (instead of scanning NPM dist-tags).
Changes:
- Added
core-web/libs/sdk/VERSIONand set it to1.2.6as the base SDK version. - Updated the
deploy-javascript-sdkcomposite action to read the base version fromVERSIONand generatenextversions using a CI-derived suffix. - Updated the manual SDK release workflow to bump/commit the
VERSIONfile before publishing.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
core-web/libs/sdk/VERSION |
Introduces the canonical SDK base version file. |
.github/workflows/cicd_manual-release-sdks.yml |
Bumps and commits VERSION before running the publish action. |
.github/actions/core-cicd/deployment/deploy-javascript-sdk/action.yml |
Replaces NPM-scanning version logic with VERSION-based version selection and simplified publishing. |
- Add VERSION file existence check with clear error message - Fix run_number collision: use run_id-run_attempt (globally unique) - Fix double-bump bug: remove pre-bump steps from manual workflow; action now owns the single VERSION increment and git commit/push - Add custom-version same-as-current guard to prevent no-op commits - Add permissions: contents: write to manual release job - Fix for sdk in $(ls) fragility: use find -type d instead Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
All concrete issues from the automated review and inline comments have been addressed in fcbbd58:
Regarding the architectural concerns (@spbolton):
|
Maven was only used to install the Node/yarn toolchain. Replacing with actions/setup-node is faster and removes the Java dependency entirely. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Move VERSION commit/push to after successful publish so the repo version always reflects what actually landed on NPM - Enable Corepack after setup-node to guarantee the Yarn version declared in packageManager is used, not the runner default - Fail fast with a clear error on unknown version-type instead of silently falling through to auto-no-increment Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Use node-version-file: .nvmrc instead of hardcoded Node version - Add set -euo pipefail to bash steps that mutate package.json so any jq failure stops the action immediately instead of silently continuing - Write actual_published_latest/next outputs before exit 1 so the VERSION commit step fires correctly when latest succeeds but next fails - Update PR description to reflect that the action owns VERSION commits Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Addresses architectural concern about VERSION file on main and merge queue disruption from direct pushes. action.yml: - Removed version increment logic and git commit/push — action is now a pure publisher, reads VERSION from whatever ref is checked out - Replaced version-type/custom-version inputs with publish-latest flag - @next always published; @latest only when publish-latest=true cicd_manual-release-sdks.yml: - Creates a release branch (sdk/release-X.Y.Z) from main - Commits VERSION bump on the release branch, never on main directly - Publishes @latest from the release branch - Opens a PR to bump VERSION to the next patch on main so trunk @next builds stay ahead of @latest semver-wise - No merge queue bypass; main only changes via normal PR flow Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@spbolton — all three concerns addressed in cb50376, the model now aligns with the existing dotCMS release pattern: Determinism / VERSION on main — main still has the VERSION file, but it only changes via normal PRs through the merge queue (the post-release bump PR). No direct pushes to main from CI. Trunk reads VERSION as-is and publishes Merge queue disruption — eliminated. Manual releases now create a release branch (
The alternative you described (release branch pattern) is exactly what's now implemented. Thanks for the detailed write-up — it made the right direction clear. |
- Remove unused npm-package-tag input from action (tags are hardcoded to latest/next and the input was never wired up) - Add set -euo pipefail to publish step so jq failures fail fast - Add VERSION file existence and semver validation in manual workflow before arithmetic to give a clear error on malformed input - Reset and clean workspace before git checkout main in post-release step so dirty package.json files from the publish action don't block the branch switch Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
What
Replaces the SDK publish action's version detection logic with a single `VERSION` file at `core-web/libs/sdk/VERSION`.
Why
The old system scanned NPM dist-tags across all packages at publish time and picked the highest version globally. This broke in two ways:
How it works
Publishing
@next(automatic)Every merge to main triggers a trunk run that publishes all SDK packages to the `@next` NPM tag. The version is `{VERSION}-next.{run_number}` (e.g. `1.2.6-next.42`). No manual steps, no branch creation needed.
Publishing
@latest(manual release)Run the Manual SDK Release workflow from GitHub Actions UI:
You do not create the branch manually — the workflow handles it. You only trigger the workflow.
Changes
Result
Closes #35109
This PR fixes: #35109