Skip to content

Commit 6517eb2

Browse files
committed
fix: look for tags on release branch
1 parent 48eca97 commit 6517eb2

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

scripts/next-version.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,20 @@ export async function getNextVersion(): Promise<VersionInfo> {
4141
let from: string
4242

4343
try {
44-
const tag = git('describe', '--tags', '--abbrev=0', '--match', 'v*')
44+
const tag = git('describe', '--tags', '--abbrev=0', '--match', 'v*', 'origin/release')
4545
current = tag.replace(/^v/, '')
4646
from = tag
4747
} catch {
48-
// No reachable tags — start from the initial commit
49-
current = '0.0.0'
50-
from = git('rev-list', '--max-parents=0', 'HEAD')
48+
try {
49+
// Fallback: check tags reachable from HEAD (works in local dev)
50+
const tag = git('describe', '--tags', '--abbrev=0', '--match', 'v*')
51+
current = tag.replace(/^v/, '')
52+
from = tag
53+
} catch {
54+
// No reachable tags — start from the initial commit
55+
current = '0.0.0'
56+
from = git('rev-list', '--max-parents=0', 'HEAD')
57+
}
5158
}
5259

5360
// Collect commit subjects since last tag (exclude merges)

0 commit comments

Comments
 (0)