Skip to content

Commit a1eb223

Browse files
committed
fix: handle beta version bumping in publish script
- Add regex to properly parse prerelease versions (e.g. 3.0.0-beta.11) - Bump prerelease number on patch (3.0.0-beta.11 → 3.0.0-beta.12) - Update contributor API to use fork repo
1 parent b9ab588 commit a1eb223

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

script/publish.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ async function fetchPreviousVersion(): Promise<string> {
2222
}
2323

2424
function bumpVersion(version: string, type: "major" | "minor" | "patch"): string {
25+
const prereleaseMatch = version.match(/^(\d+)\.(\d+)\.(\d+)-([a-zA-Z]+)\.(\d+)$/)
26+
if (prereleaseMatch) {
27+
const [, major, minor, patch, tag, preNum] = prereleaseMatch
28+
switch (type) {
29+
case "major":
30+
return `${Number(major) + 1}.0.0`
31+
case "minor":
32+
return `${major}.${Number(minor) + 1}.0`
33+
case "patch":
34+
return `${major}.${minor}.${patch}-${tag}.${Number(preNum) + 1}`
35+
}
36+
}
37+
2538
const [major, minor, patch] = version.split(".").map(Number)
2639
switch (type) {
2740
case "major":
@@ -68,11 +81,11 @@ async function generateChangelog(previous: string): Promise<string[]> {
6881
async function getContributors(previous: string): Promise<string[]> {
6982
const notes: string[] = []
7083

71-
const team = ["actions-user", "github-actions[bot]", "code-yeongyu"]
84+
const team = ["actions-user", "github-actions[bot]", "code-yeongyu", "ReinaMacCredy"]
7285

7386
try {
7487
const compare =
75-
await $`gh api "/repos/code-yeongyu/oh-my-opencode/compare/v${previous}...HEAD" --jq '.commits[] | {login: .author.login, message: .commit.message}'`.text()
88+
await $`gh api "/repos/ReinaMacCredy/oh-my-opencode/compare/v${previous}...HEAD" --jq '.commits[] | {login: .author.login, message: .commit.message}'`.text()
7689
const contributors = new Map<string, string[]>()
7790

7891
for (const line of compare.split("\n").filter(Boolean)) {

0 commit comments

Comments
 (0)