(channel: Channel)
| 62 | } |
| 63 | |
| 64 | async function commandVersion(channel: Channel): Promise<void> { |
| 65 | const previous = await getLatestRelease({ |
| 66 | excludeBetaReleases: channel === 'production', |
| 67 | excludeTestReleases: true, |
| 68 | }) |
| 69 | |
| 70 | const next = getNextVersionNumber(previous, channel) |
| 71 | |
| 72 | const outputs: Record<string, string> = { |
| 73 | previous, |
| 74 | next, |
| 75 | 'compare-base': previous, |
| 76 | } |
| 77 | |
| 78 | if (channel === 'production') { |
| 79 | // For production releases, discover the latest beta tag so the |
| 80 | // workflow can branch from it (avoids shipping untested code). |
| 81 | try { |
| 82 | const latestBeta = await getLatestRelease({ |
| 83 | excludeBetaReleases: false, |
| 84 | excludeTestReleases: true, |
| 85 | onlyBetaReleases: true, |
| 86 | }) |
| 87 | |
| 88 | outputs['latest-beta'] = latestBeta |
| 89 | } catch (e) { |
| 90 | throw new Error( |
| 91 | 'Unable to determine the latest beta release tag for a production release. ' + |
| 92 | 'Production releases must be based on a beta tag. ' + |
| 93 | `(${e instanceof Error ? e.message : e})` |
| 94 | ) |
| 95 | } |
| 96 | } else if (channel === 'beta') { |
| 97 | // For beta releases, use the latest beta tag as the comparison base |
| 98 | // for release notes generation. This ensures notes reflect changes |
| 99 | // since the last beta, not the last production release. |
| 100 | try { |
| 101 | const latestBeta = await getLatestRelease({ |
| 102 | excludeBetaReleases: false, |
| 103 | excludeTestReleases: true, |
| 104 | onlyBetaReleases: true, |
| 105 | }) |
| 106 | outputs['compare-base'] = latestBeta |
| 107 | } catch (e) { |
| 108 | const message = e instanceof Error ? e.message : String(e) |
| 109 | if (message.includes('No matching release tags found')) { |
| 110 | // No beta tags exist yet — fall back to previous (production tag) |
| 111 | console.log( |
| 112 | 'ℹ️ No beta tags found, using previous release as compare base' |
| 113 | ) |
| 114 | } else { |
| 115 | throw e |
| 116 | } |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | console.log(`📦 Previous: ${previous} → Next: ${next}`) |
| 121 | console.log(`📊 Compare base: ${outputs['compare-base']}`) |
no test coverage detected