diff options
| author | Dax Raad <[email protected]> | 2025-08-10 22:15:07 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-08-10 22:23:59 -0400 |
| commit | 81534ab387c9cf7d3e3c1e06d796554f2c81668c (patch) | |
| tree | 1f1f900be51894267c0e58afda59ad729f024b40 /script/publish.ts | |
| parent | 409a6f93b2b79bf52c66889c653a1312ee0cccc5 (diff) | |
| download | opencode-81534ab387c9cf7d3e3c1e06d796554f2c81668c.tar.gz opencode-81534ab387c9cf7d3e3c1e06d796554f2c81668c.zip | |
ci: tweaks
Diffstat (limited to 'script/publish.ts')
| -rwxr-xr-x | script/publish.ts | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/script/publish.ts b/script/publish.ts index 7a48749d1..7a1ec0601 100755 --- a/script/publish.ts +++ b/script/publish.ts @@ -1,6 +1,7 @@ #!/usr/bin/env bun import { $ } from "bun" +import path from "path" console.log("=== publishing ===\n") @@ -38,10 +39,46 @@ await import(`../packages/sdk/js/script/publish.ts`) console.log("\n=== plugin ===\n") await import(`../packages/plugin/script/publish.ts`) +const dir = new URL("..", import.meta.url).pathname +process.chdir(dir) + if (!snapshot) { await $`git commit -am "release: v${version}"` await $`git tag v${version}` await $`git push origin HEAD --tags --no-verify` + + const previous = await fetch("https://api.github.com/repos/sst/opencode/releases/latest") + .then((res) => { + if (!res.ok) throw new Error(res.statusText) + return res.json() + }) + .then((data) => data.tag_name) + + console.log("finding commits between", previous, "and", "HEAD") + const commits = await fetch(`https://api.github.com/repos/sst/opencode/compare/${previous}...HEAD`) + .then((res) => res.json()) + .then((data) => data.commits || []) + + const raw = commits.map((commit: any) => `- ${commit.commit.message.split("\n").join(" ")}`) + console.log(raw) + + const notes = + raw + .filter((x: string) => { + const lower = x.toLowerCase() + return ( + !lower.includes("release:") && + !lower.includes("ignore:") && + !lower.includes("chore:") && + !lower.includes("ci:") && + !lower.includes("wip:") && + !lower.includes("docs:") && + !lower.includes("doc:") + ) + }) + .join("\n") || "No notable changes" + + await $`gh release create v${version} --title "v${version}" --notes ${notes} ./packages/opencode/dist/*.zip` } if (snapshot) { await $`git checkout -b snapshot-${version}` |
