feat: changelog-driven versioning and idempotent Gitea registry release scripts
This commit is contained in:
1 parent
f10b885d1c
commit
023e012eda
5 files changed
+326
-6
No files matched your search
+4
-5
@@ -19,8 +19,8 @@ export function latestVersion(changelog: string): string {
|
||||
}
|
||||
|
||||
export function bumpMinor(version: string): string {
|
||||
const [major, minor, patch] = version.split(".")
|
||||
if (patch.includes("-")) return `${major}.${minor}.${patch}` // prerelease: keep as-is
|
||||
if (version.includes("-")) return version // prerelease: keep as-is
|
||||
const [major, minor] = version.split(".")
|
||||
return `${major}.${Number(minor) + 1}.0`
|
||||
}
|
||||
|
||||
@@ -56,7 +56,8 @@ export function insertEntry(changelog: string, entry: SyncEntry): string {
|
||||
const i = changelog.indexOf(marker)
|
||||
if (i === -1) throw new Error("CHANGELOG.md has no `## [Unreleased]` heading")
|
||||
const after = i + marker.length
|
||||
return `${changelog.slice(0, after)}\n\n${entry.body}\n${changelog.slice(after)}`
|
||||
const rest = changelog.slice(after).replace(/^\n+/, "")
|
||||
return `${changelog.slice(0, after)}\n\n${entry.body}\n\n${rest}`
|
||||
}
|
||||
|
||||
function main() {
|
||||
@@ -82,8 +83,6 @@ function main() {
|
||||
return
|
||||
}
|
||||
writeFileSync(changelogPath, insertEntry(changelog, entry))
|
||||
state.released_commit = target.commit
|
||||
writeFileSync(path.join(root, ".opencode/state/upstream.json"), JSON.stringify(state, null, 2) + "\n")
|
||||
console.log(`prepared release ${entry.version} for upstream ${target.commit.slice(0, 9)}`)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user