@grunnverk/commands-publish 1.5.7-dev.20260131224204.ba5749e → 1.5.7-dev.20260131231507.728276

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2021,8 +2021,19 @@ const execute = async (runConfig)=>{
2021
2021
  }
2022
2022
  if (pr) {
2023
2023
  logger.info(`PR_FOUND: Existing pull request detected for current branch | URL: ${pr.html_url} | Status: open`);
2024
+ // Even when PR exists, we need to determine the version for tagging later
2025
+ logger.info('VERSION_DETERMINATION: Determining version from current package.json | Purpose: Tag creation after merge');
2026
+ if (!isDryRun) {
2027
+ const packageJsonContents = await storage.readFile('package.json', 'utf-8');
2028
+ const parsed = safeJsonParse(packageJsonContents, 'package.json');
2029
+ const packageJson = validatePackageJson(parsed, 'package.json');
2030
+ newVersion = packageJson.version;
2031
+ logger.info(`VERSION_DETECTED: Version determined from package.json | Version: ${newVersion} | Source: current working branch`);
2032
+ } else {
2033
+ newVersion = '1.0.0'; // Mock version for dry run
2034
+ }
2024
2035
  } else {
2025
- var _runConfig_publish4, _runConfig_publish5, _runConfig_publish6, _runConfig_publish7, _runConfig_publish8, _runConfig_publish9, _runConfig_publish10, _runConfig_publish11, _runConfig_publish12, _runConfig_publish13, _releaseConfig_release;
2036
+ var _runConfig_publish4, _runConfig_publish5, _runConfig_publish6, _runConfig_publish7, _runConfig_publish8, _runConfig_publish9, _runConfig_publish10, _runConfig_publish11, _runConfig_publish12, _releaseConfig_release;
2026
2037
  logger.info('PR_NOT_FOUND: No open pull request exists for current branch | Action: Starting new release publishing process | Next: Prepare dependencies and version');
2027
2038
  // STEP 1: Prepare for release (update dependencies and run prepublish checks) with NO version bump yet
2028
2039
  logger.verbose('RELEASE_PREP_STARTING: Preparing for release | Phase: dependency management | Action: Switch from workspace to remote dependencies | Version Bump: Not yet applied');
@@ -2082,121 +2093,20 @@ const execute = async (runConfig)=>{
2082
2093
  logger.verbose('DEPS_COMMIT_SKIPPED: No dependency changes to commit | Files: ' + filesToStage + ' | Action: Skipping commit step');
2083
2094
  }
2084
2095
  }
2085
- // STEP 3: Merge target branch into working branch (optional - now skipped by default since post-publish sync keeps branches in sync)
2086
- const skipPreMerge = ((_runConfig_publish7 = runConfig.publish) === null || _runConfig_publish7 === void 0 ? void 0 : _runConfig_publish7.skipPrePublishMerge) !== false; // Default to true (skip)
2087
- if (skipPreMerge) {
2088
- logger.verbose(`PRE_MERGE_SKIPPED: Skipping pre-publish merge of target branch | Reason: Post-publish sync handles branch synchronization | Target: ${targetBranch} | Config: skipPrePublishMerge=true`);
2089
- } else {
2090
- logger.info(`PRE_MERGE_STARTING: Merging target branch into current branch | Target: ${targetBranch} | Purpose: Avoid version conflicts | Phase: pre-publish`);
2091
- if (isDryRun) {
2092
- logger.info(`Would merge ${targetBranch} into current branch`);
2093
- } else {
2094
- // Wrap entire merge process with git lock (involves fetch, merge, checkout, add, commit)
2095
- await runGitWithLock(process.cwd(), async ()=>{
2096
- // Fetch the latest target branch
2097
- try {
2098
- await run(`git fetch origin ${targetBranch}:${targetBranch}`);
2099
- logger.info(`TARGET_BRANCH_FETCHED: Successfully fetched latest target branch | Branch: ${targetBranch} | Remote: origin/${targetBranch} | Purpose: Pre-merge sync`);
2100
- } catch (fetchError) {
2101
- logger.warn(`TARGET_BRANCH_FETCH_FAILED: Unable to fetch target branch | Branch: ${targetBranch} | Error: ${fetchError.message} | Impact: Proceeding without merge, PR may have conflicts`);
2102
- logger.warn('MERGE_SKIPPED_NO_FETCH: Continuing without pre-merge | Reason: Target branch fetch failed | Impact: PR may require manual conflict resolution');
2103
- }
2104
- // Check if merge is needed (avoid unnecessary merge commits)
2105
- try {
2106
- const { stdout: mergeBase } = await run(`git merge-base HEAD ${targetBranch}`);
2107
- const { stdout: targetCommit } = await run(`git rev-parse ${targetBranch}`);
2108
- if (mergeBase.trim() === targetCommit.trim()) {
2109
- logger.info(`MERGE_NOT_NEEDED: Current branch already up-to-date with target | Branch: ${targetBranch} | Status: in-sync | Action: Skipping merge`);
2110
- } else {
2111
- // Try to merge target branch into current branch
2112
- let mergeSucceeded = false;
2113
- try {
2114
- await run(`git merge ${targetBranch} --no-edit -m "Merge ${targetBranch} to sync before version bump"`);
2115
- logger.info(`MERGE_SUCCESS: Successfully merged target branch into current branch | Target: ${targetBranch} | Purpose: Sync before version bump`);
2116
- mergeSucceeded = true;
2117
- } catch (mergeError) {
2118
- // If merge conflicts occur, check if they're only in version-related files
2119
- const errorText = [
2120
- mergeError.message || '',
2121
- mergeError.stdout || '',
2122
- mergeError.stderr || ''
2123
- ].join(' ');
2124
- if (errorText.includes('CONFLICT')) {
2125
- logger.warn(`MERGE_CONFLICTS_DETECTED: Merge conflicts found, attempting automatic resolution | Target: ${targetBranch} | Strategy: Auto-resolve version files`);
2126
- // Get list of conflicted files
2127
- const { stdout: conflictedFiles } = await run('git diff --name-only --diff-filter=U');
2128
- const conflicts = conflictedFiles.trim().split('\n').filter(Boolean);
2129
- logger.verbose(`MERGE_CONFLICTS_LIST: Conflicted files detected | Files: ${conflicts.join(', ')} | Count: ${conflicts.length}`);
2130
- // Check if conflicts are only in package.json (package-lock.json is gitignored)
2131
- const versionFiles = [
2132
- 'package.json'
2133
- ];
2134
- const nonVersionConflicts = conflicts.filter((f)=>!versionFiles.includes(f));
2135
- if (nonVersionConflicts.length > 0) {
2136
- logger.error(`MERGE_AUTO_RESOLVE_FAILED: Cannot auto-resolve conflicts in non-version files | Files: ${nonVersionConflicts.join(', ')} | Count: ${nonVersionConflicts.length} | Resolution: Manual intervention required`);
2137
- logger.error('');
2138
- logger.error('CONFLICT_RESOLUTION_REQUIRED: Manual steps to resolve conflicts:');
2139
- logger.error(' Step 1: Resolve conflicts in the files listed above');
2140
- logger.error(' Step 2: Stage resolved files | Command: git add <resolved-files>');
2141
- logger.error(' Step 3: Complete merge commit | Command: git commit');
2142
- logger.error(' Step 4: Resume publish process | Command: kodrdriv publish');
2143
- logger.error('');
2144
- throw new Error(`Merge conflicts in non-version files. Please resolve manually.`);
2145
- }
2146
- // Auto-resolve version conflicts by accepting current branch versions
2147
- // (keep our working branch's version, which is likely already updated)
2148
- logger.info(`MERGE_AUTO_RESOLVING: Automatically resolving version conflicts | Strategy: Keep current branch versions | Files: ${versionFiles.join(', ')}`);
2149
- for (const file of conflicts){
2150
- if (versionFiles.includes(file)) {
2151
- await run(`git checkout --ours ${file}`);
2152
- await run(`git add ${file}`);
2153
- logger.verbose(`MERGE_FILE_RESOLVED: Resolved file using current branch version | File: ${file} | Strategy: checkout --ours`);
2154
- }
2155
- }
2156
- // Complete the merge
2157
- await run(`git commit --no-edit -m "Merge ${targetBranch} to sync before version bump (auto-resolved version conflicts)"`);
2158
- logger.info(`MERGE_AUTO_RESOLVE_SUCCESS: Successfully auto-resolved version conflicts and completed merge | Target: ${targetBranch} | Files: ${versionFiles.join(', ')}`);
2159
- mergeSucceeded = true;
2160
- } else {
2161
- // Not a conflict error, re-throw
2162
- throw mergeError;
2163
- }
2164
- }
2165
- // Only run npm install if merge actually happened
2166
- if (mergeSucceeded) {
2167
- // Run npm install to update package-lock.json based on merged package.json
2168
- logger.info('POST_MERGE_NPM_INSTALL: Running npm install after merge | Purpose: Update package-lock.json based on merged package.json | Command: npm install');
2169
- await run('npm install');
2170
- logger.info('POST_MERGE_NPM_COMPLETE: npm install completed successfully | Status: Dependencies synchronized');
2171
- // Commit any changes from npm install (e.g., package-lock.json updates)
2172
- const { stdout: mergeChangesStatus } = await run('git status --porcelain');
2173
- if (mergeChangesStatus.trim()) {
2174
- logger.verbose('POST_MERGE_CHANGES_DETECTED: Changes detected after npm install | Action: Staging for commit | Command: git add');
2175
- // Skip package-lock.json as it's in .gitignore to avoid private registry refs
2176
- const filesToStagePostMerge = 'package.json';
2177
- await run(`git add ${filesToStagePostMerge}`);
2178
- if (await Diff.hasStagedChanges()) {
2179
- logger.verbose('POST_MERGE_COMMIT: Committing post-merge changes | Files: ' + filesToStagePostMerge + ' | Purpose: Finalize merge');
2180
- await Commit.commit(runConfig);
2181
- }
2182
- }
2183
- }
2184
- }
2185
- } catch (error) {
2186
- // Only catch truly unexpected errors here
2187
- logger.error(`MERGE_UNEXPECTED_ERROR: Unexpected error during merge process | Error: ${error.message} | Target: ${targetBranch} | Action: Aborting publish`);
2188
- throw error;
2189
- }
2190
- }, `merge ${targetBranch} into current branch`);
2191
- }
2192
- }
2096
+ // STEP 3: Pre-merge target into working (REMOVED)
2097
+ // This step was previously used to merge target branch into working before creating PR.
2098
+ // It's no longer needed because:
2099
+ // 1. check-development already ensures branches are in sync
2100
+ // 2. Post-publish sync handles branch synchronization
2101
+ // 3. Squash merge workflow makes pre-merge unnecessary
2102
+ // If branches have diverged, the PR will show conflicts that need manual resolution.
2193
2103
  // STEP 4: Determine and set target version AFTER checks, dependency commit, and target branch merge
2194
2104
  logger.info('Determining target version...');
2195
2105
  if (isDryRun) {
2196
2106
  logger.info('Would determine target version and update package.json');
2197
2107
  newVersion = '1.0.0'; // Mock version for dry run
2198
2108
  } else {
2199
- var _runConfig_publish14;
2109
+ var _runConfig_publish13;
2200
2110
  const packageJsonContents = await storage.readFile('package.json', 'utf-8');
2201
2111
  const parsed = safeJsonParse(packageJsonContents, 'package.json');
2202
2112
  const packageJson = validatePackageJson(parsed, 'package.json');
@@ -2213,9 +2123,9 @@ const execute = async (runConfig)=>{
2213
2123
  // Update targetBranch for the rest of the function
2214
2124
  targetBranch = finalTargetBranch;
2215
2125
  } else {
2216
- var _runConfig_publish15;
2126
+ var _runConfig_publish14;
2217
2127
  // Use existing logic for backward compatibility
2218
- const targetVersionInput = ((_runConfig_publish15 = runConfig.publish) === null || _runConfig_publish15 === void 0 ? void 0 : _runConfig_publish15.targetVersion) || 'patch';
2128
+ const targetVersionInput = ((_runConfig_publish14 = runConfig.publish) === null || _runConfig_publish14 === void 0 ? void 0 : _runConfig_publish14.targetVersion) || 'patch';
2219
2129
  proposedVersion = calculateTargetVersion(currentVersion, targetVersionInput);
2220
2130
  }
2221
2131
  const targetTagName = `v${proposedVersion}`;
@@ -2228,7 +2138,7 @@ const execute = async (runConfig)=>{
2228
2138
  const npmVersion = await getNpmPublishedVersion(packageJson.name);
2229
2139
  const tagInfo = await getTagInfo(targetTagName);
2230
2140
  if (npmVersion === proposedVersion) {
2231
- var _runConfig_publish16;
2141
+ var _runConfig_publish15;
2232
2142
  // Version is already published on npm
2233
2143
  logger.info(`VERSION_ALREADY_PUBLISHED: Version already published on npm registry | Version: ${proposedVersion} | Status: published | Action: Skipping`);
2234
2144
  logger.info(`PUBLISH_SKIPPED_DUPLICATE: Skipping publish operation | Reason: Package already at target version | Version: ${proposedVersion}`);
@@ -2237,7 +2147,7 @@ const execute = async (runConfig)=>{
2237
2147
  logger.info(` Option 1: Bump version | Command: npm version patch (or minor/major)`);
2238
2148
  logger.info(` Option 2: Re-run publish | Command: kodrdriv publish`);
2239
2149
  logger.info('');
2240
- if ((_runConfig_publish16 = runConfig.publish) === null || _runConfig_publish16 === void 0 ? void 0 : _runConfig_publish16.skipAlreadyPublished) {
2150
+ if ((_runConfig_publish15 = runConfig.publish) === null || _runConfig_publish15 === void 0 ? void 0 : _runConfig_publish15.skipAlreadyPublished) {
2241
2151
  logger.info('PUBLISH_SKIPPED_FLAG: Skipping package due to flag | Flag: --skip-already-published | Version: ' + proposedVersion + ' | Status: skipped');
2242
2152
  // Emit skip marker for tree mode detection with reason
2243
2153
  // eslint-disable-next-line no-console
@@ -2249,7 +2159,7 @@ const execute = async (runConfig)=>{
2249
2159
  throw new Error(`Version ${proposedVersion} already published. Use --skip-already-published to continue.`);
2250
2160
  }
2251
2161
  } else {
2252
- var _tagInfo_commit, _runConfig_publish17;
2162
+ var _tagInfo_commit, _runConfig_publish16;
2253
2163
  // Tag exists but version not on npm - likely failed previous publish
2254
2164
  logger.warn('');
2255
2165
  logger.warn('PUBLISH_SITUATION_ANALYSIS: Analyzing publish conflict situation | Tag: ' + targetTagName + ' | npm: ' + (npmVersion || 'not published'));
@@ -2264,7 +2174,7 @@ const execute = async (runConfig)=>{
2264
2174
  logger.warn(` Command: git tag -d ${targetTagName}`);
2265
2175
  logger.warn(` Command: git push origin :refs/tags/${targetTagName}`);
2266
2176
  logger.warn('');
2267
- if ((_runConfig_publish17 = runConfig.publish) === null || _runConfig_publish17 === void 0 ? void 0 : _runConfig_publish17.forceRepublish) {
2177
+ if ((_runConfig_publish16 = runConfig.publish) === null || _runConfig_publish16 === void 0 ? void 0 : _runConfig_publish16.forceRepublish) {
2268
2178
  logger.info('PUBLISH_FORCE_REPUBLISH: Force republish mode enabled | Action: Deleting existing tag | Tag: ' + targetTagName + ' | Purpose: Allow republish');
2269
2179
  if (!isDryRun) {
2270
2180
  const { runSecure } = await import('@grunnverk/git-tools');
@@ -2299,18 +2209,18 @@ const execute = async (runConfig)=>{
2299
2209
  }
2300
2210
  }
2301
2211
  }
2302
- if ((_runConfig_publish14 = runConfig.publish) === null || _runConfig_publish14 === void 0 ? void 0 : _runConfig_publish14.interactive) {
2303
- var _runConfig_publish18;
2304
- newVersion = await confirmVersionInteractively(currentVersion, proposedVersion, (_runConfig_publish18 = runConfig.publish) === null || _runConfig_publish18 === void 0 ? void 0 : _runConfig_publish18.targetVersion);
2212
+ if ((_runConfig_publish13 = runConfig.publish) === null || _runConfig_publish13 === void 0 ? void 0 : _runConfig_publish13.interactive) {
2213
+ var _runConfig_publish17;
2214
+ newVersion = await confirmVersionInteractively(currentVersion, proposedVersion, (_runConfig_publish17 = runConfig.publish) === null || _runConfig_publish17 === void 0 ? void 0 : _runConfig_publish17.targetVersion);
2305
2215
  const confirmedTagName = `v${newVersion}`;
2306
2216
  const confirmedTagExists = await checkIfTagExists(confirmedTagName);
2307
2217
  if (confirmedTagExists) {
2308
- var _runConfig_publish19;
2218
+ var _runConfig_publish18;
2309
2219
  const { getNpmPublishedVersion } = await import('@grunnverk/core');
2310
2220
  const npmVersion = await getNpmPublishedVersion(packageJson.name);
2311
2221
  if (npmVersion === newVersion) {
2312
2222
  throw new Error(`Tag ${confirmedTagName} already exists and version is published on npm. Please choose a different version.`);
2313
- } else if (!((_runConfig_publish19 = runConfig.publish) === null || _runConfig_publish19 === void 0 ? void 0 : _runConfig_publish19.forceRepublish)) {
2223
+ } else if (!((_runConfig_publish18 = runConfig.publish) === null || _runConfig_publish18 === void 0 ? void 0 : _runConfig_publish18.forceRepublish)) {
2314
2224
  throw new Error(`Tag ${confirmedTagName} already exists. Use --force-republish to override.`);
2315
2225
  }
2316
2226
  // If forceRepublish is set, we'll continue (tag will be deleted later)
@@ -2354,23 +2264,23 @@ const execute = async (runConfig)=>{
2354
2264
  ...runConfig.release,
2355
2265
  currentBranch: currentBranch,
2356
2266
  version: newVersion,
2357
- ...((_runConfig_publish8 = runConfig.publish) === null || _runConfig_publish8 === void 0 ? void 0 : _runConfig_publish8.from) && {
2267
+ ...((_runConfig_publish7 = runConfig.publish) === null || _runConfig_publish7 === void 0 ? void 0 : _runConfig_publish7.from) && {
2358
2268
  from: runConfig.publish.from
2359
2269
  },
2360
- ...((_runConfig_publish9 = runConfig.publish) === null || _runConfig_publish9 === void 0 ? void 0 : _runConfig_publish9.interactive) && {
2270
+ ...((_runConfig_publish8 = runConfig.publish) === null || _runConfig_publish8 === void 0 ? void 0 : _runConfig_publish8.interactive) && {
2361
2271
  interactive: runConfig.publish.interactive
2362
2272
  },
2363
- ...((_runConfig_publish10 = runConfig.publish) === null || _runConfig_publish10 === void 0 ? void 0 : _runConfig_publish10.fromMain) && {
2273
+ ...((_runConfig_publish9 = runConfig.publish) === null || _runConfig_publish9 === void 0 ? void 0 : _runConfig_publish9.fromMain) && {
2364
2274
  fromMain: runConfig.publish.fromMain
2365
2275
  }
2366
2276
  };
2367
- if ((_runConfig_publish11 = runConfig.publish) === null || _runConfig_publish11 === void 0 ? void 0 : _runConfig_publish11.from) {
2277
+ if ((_runConfig_publish10 = runConfig.publish) === null || _runConfig_publish10 === void 0 ? void 0 : _runConfig_publish10.from) {
2368
2278
  logger.verbose(`Using custom 'from' reference for release notes: ${runConfig.publish.from}`);
2369
2279
  }
2370
- if ((_runConfig_publish12 = runConfig.publish) === null || _runConfig_publish12 === void 0 ? void 0 : _runConfig_publish12.interactive) {
2280
+ if ((_runConfig_publish11 = runConfig.publish) === null || _runConfig_publish11 === void 0 ? void 0 : _runConfig_publish11.interactive) {
2371
2281
  logger.verbose('Interactive mode enabled for release notes generation');
2372
2282
  }
2373
- if ((_runConfig_publish13 = runConfig.publish) === null || _runConfig_publish13 === void 0 ? void 0 : _runConfig_publish13.fromMain) {
2283
+ if ((_runConfig_publish12 = runConfig.publish) === null || _runConfig_publish12 === void 0 ? void 0 : _runConfig_publish12.fromMain) {
2374
2284
  logger.verbose('Forcing comparison against main branch for release notes');
2375
2285
  }
2376
2286
  // Log self-reflection settings for debugging
@@ -2435,12 +2345,12 @@ const execute = async (runConfig)=>{
2435
2345
  logger.debug(`Could not verify workflow configuration for wait skip: ${error.message}`);
2436
2346
  }
2437
2347
  if (!shouldSkipWait) {
2438
- var _runConfig_publish20, _runConfig_publish21, _runConfig_publish22;
2348
+ var _runConfig_publish19, _runConfig_publish20, _runConfig_publish21;
2439
2349
  // Configure timeout and user confirmation behavior
2440
- const timeout = ((_runConfig_publish20 = runConfig.publish) === null || _runConfig_publish20 === void 0 ? void 0 : _runConfig_publish20.checksTimeout) || KODRDRIV_DEFAULTS.publish.checksTimeout;
2441
- const senditMode = ((_runConfig_publish21 = runConfig.publish) === null || _runConfig_publish21 === void 0 ? void 0 : _runConfig_publish21.sendit) || false;
2350
+ const timeout = ((_runConfig_publish19 = runConfig.publish) === null || _runConfig_publish19 === void 0 ? void 0 : _runConfig_publish19.checksTimeout) || KODRDRIV_DEFAULTS.publish.checksTimeout;
2351
+ const senditMode = ((_runConfig_publish20 = runConfig.publish) === null || _runConfig_publish20 === void 0 ? void 0 : _runConfig_publish20.sendit) || false;
2442
2352
  // sendit flag overrides skipUserConfirmation - if sendit is true, skip confirmation
2443
- const skipUserConfirmation = senditMode || ((_runConfig_publish22 = runConfig.publish) === null || _runConfig_publish22 === void 0 ? void 0 : _runConfig_publish22.skipUserConfirmation) || false;
2353
+ const skipUserConfirmation = senditMode || ((_runConfig_publish21 = runConfig.publish) === null || _runConfig_publish21 === void 0 ? void 0 : _runConfig_publish21.skipUserConfirmation) || false;
2444
2354
  await GitHub.waitForPullRequestChecks(pr.number, {
2445
2355
  timeout,
2446
2356
  skipUserConfirmation
@@ -2565,50 +2475,15 @@ const execute = async (runConfig)=>{
2565
2475
  logger.warn('PUBLISH_STASH_AVAILABLE: Changes available in git stash | Command: git stash list | Purpose: View and restore manually');
2566
2476
  }
2567
2477
  }
2568
- // Update package.json on target branch to release version and commit
2569
- // This ensures the tag points to a commit with the correct release version
2478
+ // Read the version from target branch for tag creation
2479
+ // After squash merge, this should match the version we set on the working branch
2570
2480
  if (!isDryRun) {
2571
- logger.info(`PUBLISH_VERSION_UPDATE_TARGET: Updating package.json on target branch to release version | Version: ${newVersion} | Branch: ${targetBranch}`);
2572
- // Read current package.json on target branch
2573
2481
  const targetPackageJsonContents = await storage.readFile('package.json', 'utf-8');
2574
2482
  const targetPackageJson = safeJsonParse(targetPackageJsonContents, 'package.json');
2575
- // Check if version update is needed
2576
- if (targetPackageJson.version !== newVersion) {
2577
- logger.info(`PUBLISH_VERSION_MISMATCH: Version mismatch detected on target | Current: ${targetPackageJson.version} | Expected: ${newVersion} | Action: Updating`);
2578
- // Update version in package.json
2579
- targetPackageJson.version = newVersion;
2580
- await storage.writeFile('package.json', JSON.stringify(targetPackageJson, null, 2) + '\n', 'utf-8');
2581
- logger.info(`PUBLISH_VERSION_UPDATED: Updated package.json version on target branch | Version: ${newVersion} | Branch: ${targetBranch}`);
2582
- // Stage and commit the version update
2583
- await runGitWithLock(process.cwd(), async ()=>{
2584
- await runSecure('git', [
2585
- 'add',
2586
- 'package.json'
2587
- ]);
2588
- }, 'stage version update on target');
2589
- // Check if there are staged changes before committing
2590
- if (await Diff.hasStagedChanges()) {
2591
- logger.info('PUBLISH_VERSION_COMMITTING: Committing version update to target branch | Purpose: Ensure tag points to correct version');
2592
- await runGitWithLock(process.cwd(), async ()=>{
2593
- await Commit.commit(runConfig);
2594
- }, 'commit version update on target');
2595
- logger.info('PUBLISH_VERSION_COMMITTED: Version update committed successfully');
2596
- // Push the version update to remote
2597
- logger.info(`PUBLISH_VERSION_PUSHING: Pushing version update to remote | Branch: ${targetBranch} | Remote: origin`);
2598
- await runGitWithLock(process.cwd(), async ()=>{
2599
- await runSecure('git', [
2600
- 'push',
2601
- 'origin',
2602
- targetBranch
2603
- ]);
2604
- }, `push version update to ${targetBranch}`);
2605
- logger.info('PUBLISH_VERSION_PUSHED: Version update pushed to remote successfully');
2606
- } else {
2607
- logger.verbose('PUBLISH_VERSION_NO_CHANGES: No changes to commit (version already correct)');
2608
- }
2609
- } else {
2610
- logger.info(`PUBLISH_VERSION_CORRECT: Version already correct on target branch | Version: ${newVersion} | Branch: ${targetBranch}`);
2611
- }
2483
+ const targetVersion = targetPackageJson.version;
2484
+ logger.info(`PUBLISH_VERSION_TARGET: Version on target branch after merge | Version: ${targetVersion} | Branch: ${targetBranch}`);
2485
+ // Use the version from target branch for tagging (should match newVersion from working branch)
2486
+ newVersion = targetVersion;
2612
2487
  }
2613
2488
  // Now create and push the tag on the target branch
2614
2489
  logger.info('Creating release tag...');
@@ -2699,9 +2574,9 @@ const execute = async (runConfig)=>{
2699
2574
  }
2700
2575
  logger.info('Creating GitHub release...');
2701
2576
  if (isDryRun) {
2702
- var _runConfig_publish23;
2577
+ var _runConfig_publish22;
2703
2578
  logger.info('Would read package.json version and create GitHub release with retry logic');
2704
- const milestonesEnabled = !((_runConfig_publish23 = runConfig.publish) === null || _runConfig_publish23 === void 0 ? void 0 : _runConfig_publish23.noMilestones);
2579
+ const milestonesEnabled = !((_runConfig_publish22 = runConfig.publish) === null || _runConfig_publish22 === void 0 ? void 0 : _runConfig_publish22.noMilestones);
2705
2580
  if (milestonesEnabled) {
2706
2581
  logger.info('Would close milestone for released version');
2707
2582
  } else {
@@ -2717,11 +2592,11 @@ const execute = async (runConfig)=>{
2717
2592
  let retries = 3;
2718
2593
  while(retries > 0){
2719
2594
  try {
2720
- var _runConfig_publish24;
2595
+ var _runConfig_publish23;
2721
2596
  await GitHub.createRelease(tagName, releaseTitle, releaseNotesContent);
2722
2597
  logger.info(`GitHub release created successfully for tag: ${tagName}`);
2723
2598
  // Close milestone for this version if enabled
2724
- const milestonesEnabled = !((_runConfig_publish24 = runConfig.publish) === null || _runConfig_publish24 === void 0 ? void 0 : _runConfig_publish24.noMilestones);
2599
+ const milestonesEnabled = !((_runConfig_publish23 = runConfig.publish) === null || _runConfig_publish23 === void 0 ? void 0 : _runConfig_publish23.noMilestones);
2725
2600
  if (milestonesEnabled) {
2726
2601
  logger.info('PUBLISH_MILESTONE_CLOSING: Closing milestone for released version | Action: Close GitHub milestone | Purpose: Mark release complete');
2727
2602
  const version = tagName.replace(/^v/, ''); // Remove 'v' prefix if present
@@ -2754,12 +2629,12 @@ const execute = async (runConfig)=>{
2754
2629
  if (isDryRun) {
2755
2630
  logger.info('Would monitor GitHub Actions workflows triggered by release');
2756
2631
  } else {
2757
- var _runConfig_publish25, _runConfig_publish26, _runConfig_publish27, _runConfig_publish28;
2758
- const workflowTimeout = ((_runConfig_publish25 = runConfig.publish) === null || _runConfig_publish25 === void 0 ? void 0 : _runConfig_publish25.releaseWorkflowsTimeout) || KODRDRIV_DEFAULTS.publish.releaseWorkflowsTimeout;
2759
- const senditMode = ((_runConfig_publish26 = runConfig.publish) === null || _runConfig_publish26 === void 0 ? void 0 : _runConfig_publish26.sendit) || false;
2760
- const skipUserConfirmation = senditMode || ((_runConfig_publish27 = runConfig.publish) === null || _runConfig_publish27 === void 0 ? void 0 : _runConfig_publish27.skipUserConfirmation) || false;
2632
+ var _runConfig_publish24, _runConfig_publish25, _runConfig_publish26, _runConfig_publish27;
2633
+ const workflowTimeout = ((_runConfig_publish24 = runConfig.publish) === null || _runConfig_publish24 === void 0 ? void 0 : _runConfig_publish24.releaseWorkflowsTimeout) || KODRDRIV_DEFAULTS.publish.releaseWorkflowsTimeout;
2634
+ const senditMode = ((_runConfig_publish25 = runConfig.publish) === null || _runConfig_publish25 === void 0 ? void 0 : _runConfig_publish25.sendit) || false;
2635
+ const skipUserConfirmation = senditMode || ((_runConfig_publish26 = runConfig.publish) === null || _runConfig_publish26 === void 0 ? void 0 : _runConfig_publish26.skipUserConfirmation) || false;
2761
2636
  // Get workflow names - either from config or auto-detect
2762
- let workflowNames = (_runConfig_publish28 = runConfig.publish) === null || _runConfig_publish28 === void 0 ? void 0 : _runConfig_publish28.releaseWorkflowNames;
2637
+ let workflowNames = (_runConfig_publish27 = runConfig.publish) === null || _runConfig_publish27 === void 0 ? void 0 : _runConfig_publish27.releaseWorkflowNames;
2763
2638
  if (!workflowNames || workflowNames.length === 0) {
2764
2639
  logger.info('No specific workflow names configured, auto-detecting workflows triggered by release events...');
2765
2640
  try {