Skip to content

fix: build browser-lib bundle after version bump in release job - #1002

Merged
naveenkumar-sunkaraSFDC merged 2 commits into
salesforce:masterfrom
naveenkumar-sunkaraSFDC:fix/rebuild-bundle-after-version-bump
Sep 16, 2026
Merged

naveenkumar-sunkaraSFDC merged 2 commits into
salesforce:masterfrom
naveenkumar-sunkaraSFDC:fix/rebuild-bundle-after-version-bump

Conversation

@naveenkumar-sunkaraSFDC

Copy link
Copy Markdown
Collaborator

Problem

The published @sa11y/browser-lib bundle self-reports the wrong version. The
minified bundle stamps sa11y.version into its footer, but the value lags the
actual npm package version by one release.

Root cause is step ordering in the release job of .github/workflows/nodejs.yml:

  1. yarn build runs first and stamps the bundle from the current on-disk
    package.json version.
  2. semantic-release then runs lerna version <next>, which rewrites
    package.json to the released version.
  3. npm publish uploads the bundle that was built in step 1 — stamped with the
    pre-bump version.

Because rollup.config.mjs reads the version from package.json at build time
(getPackageVersion() → footer sa11y.version = '<pkgVersion>'), the bundle
must be built after the version bump to stamp the correct value.

Fix

Move the single yarn build to run after semantic-release has bumped the
versions, gated on .release-created (the same condition already used by the
publish step). The pre-bump build is removed — it was redundant with the
lint-build-test job that gates this one.

After this change:

  • semantic-release bumps the on-disk package.json to the released version.
  • yarn build stamps the bundle with that value.
  • npm publish uploads the correctly-stamped bundle.

No new inputs are introduced and the release remains gated on .release-created,
so behavior on non-release pushes is unchanged.

🤖 Generated with Claude Code

The release job ran `yarn build` before semantic-release bumped the
package versions. Because @sa11y/browser-lib stamps `sa11y.version` into
the minified bundle from package.json at rollup time, the published
sa11y.min.js self-reported the previous version instead of the version
just released.

Move the build to run after semantic-release (gated on .release-created,
same as npm publish) so the published bundle reports the correct
version. This keeps sa11y.version in the bundle in sync with the npm
package version that downstream consumers pin against.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.72%. Comparing base (94bc67b) to head (eaed217).
⚠️ Report is 240 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1002      +/-   ##
==========================================
- Coverage   94.88%   94.72%   -0.17%     
==========================================
  Files          27       35       +8     
  Lines         626      815     +189     
  Branches      137      178      +41     
==========================================
+ Hits          594      772     +178     
- Misses         32       43      +11     

see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vanshika-sharmaSFDC vanshika-sharmaSFDC left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the change.

@naveenkumar-sunkaraSFDC
naveenkumar-sunkaraSFDC merged commit 48ba097 into salesforce:master Sep 16, 2026
13 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 8.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants