mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-10 02:58:29 +00:00
feat(script): use GitHub run number for preview build identifier
This commit is contained in:
parent
6ca6566bd3
commit
d77b87ea65
1 changed files with 9 additions and 1 deletions
|
|
@ -33,7 +33,7 @@ const IS_PREVIEW = CHANNEL !== "latest"
|
|||
|
||||
const VERSION = await (async () => {
|
||||
if (env.OPENCODE_VERSION) return env.OPENCODE_VERSION
|
||||
if (IS_PREVIEW) return `0.0.0-${CHANNEL}-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}`
|
||||
if (IS_PREVIEW) return `0.0.0-${CHANNEL}-${previewBuildNumber()}`
|
||||
const version = await fetch("https://registry.npmjs.org/opencode-ai/latest")
|
||||
.then((res) => {
|
||||
if (!res.ok) throw new Error(res.statusText)
|
||||
|
|
@ -47,6 +47,14 @@ const VERSION = await (async () => {
|
|||
return `${major}.${minor}.${patch + 1}`
|
||||
})()
|
||||
|
||||
function previewBuildNumber() {
|
||||
const runNumber = process.env["GITHUB_RUN_NUMBER"]
|
||||
if (!runNumber) return new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")
|
||||
const runAttempt = process.env["GITHUB_RUN_ATTEMPT"]
|
||||
if (runAttempt && runAttempt !== "1") return `${runNumber}.${runAttempt}`
|
||||
return runNumber
|
||||
}
|
||||
|
||||
const bot = ["actions-user", "opencode", "opencode-agent[bot]"]
|
||||
const teamPath = path.resolve(import.meta.dir, "../../../.github/TEAM_MEMBERS")
|
||||
const team = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue