GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — opencode/script/publish.ts at dev · meatcar/opencode Expand file tree/ Copy pathpublish.tsMore file actions executable file ·94 lines (79 loc) · 2.94 KB / Copy pathpublish.tsFile metadata and controlsexecutable file ·94 lines (79 loc) · 2.94 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 #!/usr/bin/env bun import { $ } from "bun" console.log("=== publishing ===\n") const snapshot = process.env["OPENCODE_SNAPSHOT"] === "true" const version = snapshot ? `0.0.0-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}` : process.env["OPENCODE_VERSION"] if (!version) { throw new Error("OPENCODE_VERSION is required") } process.env["OPENCODE_VERSION"] = version console.log("version:", version) const pkgjsons = await Array.fromAsync( new Bun.Glob("**/package.json").scan({ absolute: true, }), ).then((arr) => arr.filter((x) => !x.includes("node_modules") && !x.includes("dist"))) const tree = await $`git add . && git write-tree`.text().then((x) => x.trim()) for (const file of pkgjsons) { let pkg = await Bun.file(file).text() pkg = pkg.replaceAll(/"version": "[^"]+"/g, `"version": "${version}"`) console.log("updated:", file) await Bun.file(file).write(pkg) } await $`bun install` console.log("\n=== opencode ===\n") await import(`../packages/opencode/script/publish.ts`) console.log("\n=== sdk ===\n") 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 fetch origin` await $`git cherry-pick HEAD..origin/dev`.nothrow() await $`git push origin HEAD --tags --no-verify --force` 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}` await $`git commit --allow-empty -m "Snapshot release v${version}"` await $`git tag v${version}` await $`git push origin v${version} --no-verify` await $`git checkout dev` await $`git branch -D snapshot-${version}` for (const file of pkgjsons) { await $`git checkout ${tree} ${file}` } } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |