GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — opencode-fork/script/publish.ts at dev · thomaspapiernik/opencode-fork

Expand file tree

/

publish.ts

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
executable file
·
133 lines (104 loc) · 4.41 KB
/

publish.ts

Copy path

File metadata and controls

executable file
·
133 lines (104 loc) · 4.41 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/usr/bin/env bun
import { Script } from "@opencode/script"
import { $ } from "bun"
import { fileURLToPath } from "url"
console.log("=== publishing ===\n")
const dir = fileURLToPath(new URL("..", import.meta.url))
process.chdir(dir)
const tag = `v${Script.version}`
// Beta dogfoods the desktop app. The CLI and SDK packages ship from dev.
if (Script.channel === "beta") {
console.log("\n=== desktop ===\n")
await $`bun ./packages/desktop/scripts/publish.ts`
process.exit(0)
}
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")))
async function prepareReleaseFiles() {
for (const file of pkgjsons) {
let pkg = await Bun.file(file).text()
pkg = pkg.replaceAll(/"version": "[^"]+"/g, `"version": "${Script.version}"`)
console.log("updated:", file)
await Bun.file(file).write(pkg)
}
await $`bun install`
}
async function writeChangelog() {
const notes = process.env["OPENCODE_RELEASE_NOTES"]?.trim()
if (!notes) return
const file = Bun.file("CHANGELOG.md")
const text = await file.text()
const lines = text.split("\n")
if (lines.some((line) => line === `## ${tag}` || line.startsWith(`## ${tag} `))) return
const index = lines.findIndex((line) => line.startsWith("## "))
const head = (index === -1 ? lines : lines.slice(0, index)).join("\n").trimEnd()
const rest = index === -1 ? "" : lines.slice(index).join("\n")
const entry = `## ${tag} — ${new Date().toISOString().slice(0, 10)}\n\n${notes}\n`
await file.write(`${head}\n\n${entry}${rest ? `\n${rest}` : ""}`)
}
if (Script.release && !Script.preview) {
await $`git fetch origin --tags`
await $`git switch --detach`
}
await prepareReleaseFiles()
if (Script.release) await $`bun ./packages/desktop/scripts/publish.ts --dry-run`
console.log("\n=== schema ===\n")
await $`bun ./packages/schema/script/publish.ts`
console.log("\n=== codemode ===\n")
await $`bun ./packages/codemode/script/publish.ts`
console.log("\n=== theme ===\n")
await $`bun ./packages/theme/script/publish.ts`
console.log("\n=== ai ===\n")
await $`bun ./packages/ai/script/publish.ts`
console.log("\n=== util ===\n")
await $`bun ./packages/util/script/publish.ts`
console.log("\n=== protocol ===\n")
await $`bun ./packages/protocol/script/publish.ts`
console.log("\n=== client ===\n")
await $`bun ./packages/client/script/publish.ts`
console.log("\n=== cli ===\n")
await $`bun ./packages/cli/script/publish.ts`
console.log("\n=== plugin ===\n")
await $`bun ./packages/plugin/script/publish.ts`
console.log("\n=== plugin-browser ===\n")
await $`bun ./packages/plugin-browser/script/publish.ts`
console.log("\n=== core ===\n")
await $`bun ./packages/core/script/publish.ts`
console.log("\n=== simulation ===\n")
await $`bun ./packages/simulation/script/publish.ts`
console.log("\n=== server ===\n")
await $`bun ./packages/server/script/publish.ts`
console.log("\n=== sdk ===\n")
await $`bun ./packages/sdk/script/publish.ts`
console.log("\n=== ui ===\n")
await $`bun ./packages/ui/script/publish.ts`
if (Script.release && !Script.preview) {
if ((await $`git diff --quiet`.nothrow()).exitCode !== 0) await $`git commit -am "release: ${tag}"`
await $`git tag -d ${tag}`.nothrow()
await $`git tag ${tag}`
await $`git push origin refs/tags/${tag} --force-with-lease --no-verify`
await new Promise((resolve) => setTimeout(resolve, 5_000))
await $`git fetch origin`
await $`git checkout -B dev origin/dev`
await prepareReleaseFiles()
await writeChangelog()
if ((await $`git diff --quiet`.nothrow()).exitCode !== 0) {
// The release already published this code; a push-triggered dev publish of a version bump is wasted work.
await $`git commit -am ${`sync release versions for ${tag} [skip ci]`}`
await $`git push origin HEAD:dev --no-verify`
}
}
if (Script.release) {
console.log("\n=== desktop ===\n")
await $`bun ./packages/desktop/scripts/publish.ts`
}
// WinGet submission is paused until our packages are accepted into microsoft/winget-pkgs.
// if (Script.release && Script.channel === "latest") {
// console.log("\n=== winget ===\n")
// // Everything else is published by now, and WinGet validation can reject a submission for reasons unrelated to the release.
// if ((await $`bun ./script/publish-winget.ts`.nothrow()).exitCode !== 0)
// console.log("::warning::WinGet submission failed; see the winget step output above")
// }
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.