@@ -346,24 +346,34 @@ async function main() {
346346 nodeCommitSha = commitData . sha ; // Full SHA for file fetching
347347 }
348348
349- // Get Node.js version from src/node_version.h using the commit SHA for consistency
350- const versionRef = nodeCommitSha || args . branch ;
351- const versionUrl = `https://raw.githubusercontent.com/${ args . repo } /${ versionRef } /src/node_version.h` ;
352- const versionResponse = await fetch ( versionUrl ) ;
353- if ( versionResponse . ok ) {
354- const versionContent = await versionResponse . text ( ) ;
355- const majorMatch = versionContent . match (
356- / # d e f i n e N O D E _ M A J O R _ V E R S I O N ( \d + ) / ,
357- ) ;
358- const minorMatch = versionContent . match (
359- / # d e f i n e N O D E _ M I N O R _ V E R S I O N ( \d + ) / ,
360- ) ;
361- const patchMatch = versionContent . match (
362- / # d e f i n e N O D E _ P A T C H _ V E R S I O N ( \d + ) / ,
363- ) ;
349+ // Only parse node_version.h for release tags (e.g., v25.8.1), not staging
350+ // branches — staging branches have version numbers bumped ahead of the
351+ // actual release, so the parsed version would be misleading.
352+ const isReleaseTag = / ^ v \d + \. \d + \. \d + $ / . test ( args . branch ) ;
364353
365- if ( majorMatch && minorMatch && patchMatch ) {
366- nodeVersion = `v${ majorMatch [ 1 ] } .${ minorMatch [ 1 ] } .${ patchMatch [ 1 ] } ` ;
354+ if ( isReleaseTag ) {
355+ nodeVersion = args . branch ;
356+ } else {
357+ const versionRef = nodeCommitSha || args . branch ;
358+ const versionUrl = `https://raw.githubusercontent.com/${ args . repo } /${ versionRef } /src/node_version.h` ;
359+ const versionResponse = await fetch ( versionUrl ) ;
360+ if ( versionResponse . ok ) {
361+ const versionContent = await versionResponse . text ( ) ;
362+ const majorMatch = versionContent . match (
363+ / # d e f i n e N O D E _ M A J O R _ V E R S I O N ( \d + ) / ,
364+ ) ;
365+ const minorMatch = versionContent . match (
366+ / # d e f i n e N O D E _ M I N O R _ V E R S I O N ( \d + ) / ,
367+ ) ;
368+ const patchMatch = versionContent . match (
369+ / # d e f i n e N O D E _ P A T C H _ V E R S I O N ( \d + ) / ,
370+ ) ;
371+
372+ if ( majorMatch && minorMatch && patchMatch ) {
373+ // Use the branch name, not the (potentially unreleased) version
374+ // from the header. The commit SHA suffix provides traceability.
375+ nodeVersion = args . branch ;
376+ }
367377 }
368378 }
369379 } catch ( err : any ) {
@@ -439,8 +449,10 @@ async function main() {
439449
440450 // Note: SQLite version update removed since we sync SQLite files from SQLite.org, not Node.js
441451
442- // Update README.md with the Node.js version
443- if ( nodeVersion ) {
452+ // Update README.md with the Node.js version (only for release tags,
453+ // not staging branches where the version would be misleading)
454+ const isReleaseTag = / ^ v \d + \. \d + \. \d + $ / . test ( nodeVersion || "" ) ;
455+ if ( nodeVersion && isReleaseTag ) {
444456 try {
445457 const readmePath = path . join ( packageRoot , "README.md" ) ;
446458 let readme = fs . readFileSync ( readmePath , "utf8" ) ;
@@ -459,6 +471,10 @@ async function main() {
459471 } catch ( err : any ) {
460472 console . error ( "Failed to update README.md:" , err . message ) ;
461473 }
474+ } else if ( nodeVersion ) {
475+ console . log (
476+ `Skipping README.md version update (synced from ${ nodeVersion } , not a release tag)` ,
477+ ) ;
462478 }
463479
464480 // Update sync cache with the current SHA
0 commit comments