fix: Published version should match (#5813)

* fix: Published version should match

* Move version number update to package.json

* fix: Netlify version number update

* Try updating platform app vesion too

* PR comments

---------

Co-authored-by: Joe Boccanfuso <109477394+jbocce@users.noreply.github.com>
This commit is contained in:
Bill Wallace 2026-02-21 18:15:10 -05:00 committed by GitHub
parent ce9f159c21
commit d359a3b784
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 29 additions and 4 deletions

View File

@ -21,7 +21,8 @@
"build:viewer": "cross-env NODE_ENV=production yarn run build",
"build:dev": "cross-env NODE_ENV=development yarn run build",
"build:aws": "cross-env NODE_ENV=development APP_CONFIG=config/aws_static.js yarn run build && gzip -9 -r dist",
"build:viewer:ci": "cross-env NODE_ENV=production PUBLIC_URL=/ APP_CONFIG=config/netlify.js QUICK_BUILD=false yarn run build",
"version:update": "cd ../.. && node ./version.mjs && cd platform/app",
"build:viewer:ci": "yarn run version:update && cross-env NODE_ENV=production PUBLIC_URL=/ APP_CONFIG=config/netlify.js QUICK_BUILD=false yarn run build",
"build:viewer:qa": "cross-env NODE_ENV=production APP_CONFIG=config/google.js yarn run build",
"build:viewer:demo": "cross-env NODE_ENV=production APP_CONFIG=config/demo.js HTML_TEMPLATE=rollbar.html QUICK_BUILD=false yarn run build",
"build": "node --max_old_space_size=8096 ./../../node_modules/webpack/bin/webpack.js --progress --config .webpack/webpack.pwa.js",

View File

@ -17,6 +17,10 @@ async function run() {
const { stdout: lastCommitMessage } = await execa('git', ['log', '--format=%B', '-n', '1']);
// Check if this is a master branch (master or \d*.\d* like 3.13, 3.14)
// Note vXXX are tags, not branches
const isMasterBranch = branchName === 'master' || /^\d+\.\d+$/.test(branchName);
let nextVersion;
if (branchName.startsWith('release')) {
@ -25,8 +29,8 @@ async function run() {
const version = await fs.readFile('./version.txt', 'utf-8');
nextVersion = version.trim();
console.log('Version from version.txt:', nextVersion);
} else {
console.log('Branch: master');
} else if (isMasterBranch) {
console.log('Branch: master (or version branch like v3.13)');
const prereleaseComponents = semver.prerelease(currentVersion);
const isBumpBeta = lastCommitMessage.trim().includes('[BUMP BETA]');
console.log('isBumpBeta', isBumpBeta);
@ -58,6 +62,22 @@ async function run() {
console.log('Bumping beta version to be fresh beta e.g., from 2.11.0 to 2.12.0-beta.0');
nextVersion = `${semver.major(currentVersion)}.${semver.minor(currentVersion) + 1}.0-beta.0`;
}
} else {
// For feature/fix branches, include the branch name in the version
console.log('Branch: feature/fix branch');
const prereleaseComponents = semver.prerelease(currentVersion);
// Sanitize branch name for use in version (replace invalid chars with dashes)
const sanitizedBranchName = branchName.replace(/[^a-zA-Z0-9-]/g, '-');
if (prereleaseComponents?.includes('beta')) {
// If current version has beta, keep it and append branch name
// e.g., from 3.13.0-beta.8 to 3.13.0-beta.8-fix-corrected-version-number
console.log(
`Adding branch name to beta version, e.g., from ${currentVersion} to ${currentVersion}-${sanitizedBranchName}`
);
nextVersion = `${currentVersion}-${sanitizedBranchName}`;
}
}
if (!nextVersion) {
@ -72,7 +92,11 @@ async function run() {
await fs.writeFile('./version.txt', versionInfo.version);
await fs.writeFile('./commit.txt', versionInfo.commit);
console.log('Version info saved to version.json');
// Also write to platform/app for webpack to read
await fs.writeFile('./platform/app/version.txt', versionInfo.version);
await fs.writeFile('./platform/app/commit.txt', versionInfo.commit);
console.log('Version info saved to version.json and platform/app');
}
run().catch(err => {