mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-17 23:24:00 +03:00
fix(release): restore desktop app-update.yml and keep V1 as the GitHub Latest release (#59529)
This commit is contained in:
committed by
GitHub
Unverified
parent
5f8ee0f507
commit
54dcd34566
@@ -14,6 +14,8 @@ printf '%s\n' "${OPENCODE_RELEASE_NOTES:-}" > "$assets.md"
|
||||
if dry_run; then exit 0; fi
|
||||
|
||||
tag="v$OPENCODE_VERSION"
|
||||
gh release view "$tag" > /dev/null 2>&1 || gh release create "$tag" --draft --verify-tag --title "$tag" --notes-file "$assets.md"
|
||||
# OpenCode 1 update paths (CLI upgrade, electron-updater, Scoop) follow GitHub's Latest release, which must stay on 1.x.
|
||||
gh release view "$tag" > /dev/null 2>&1 ||
|
||||
gh release create "$tag" --draft --verify-tag --latest=false --title "$tag" --notes-file "$assets.md"
|
||||
gh release upload "$tag" "$assets"/* --clobber
|
||||
gh release edit "$tag" --draft=false
|
||||
gh release edit "$tag" --draft=false --latest=false
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { $ } from "bun"
|
||||
import { cp, mkdir, readdir, rm } from "node:fs/promises"
|
||||
import path from "node:path"
|
||||
import { getConfig } from "../electron-builder.config"
|
||||
import { getCurrentCli, resolveChannel } from "./utils"
|
||||
|
||||
// Packages the built app (out/) for OPENCODE_TARGET into dist/desktop at the repository root, unsigned:
|
||||
@@ -50,12 +51,29 @@ if (!app && os === "mac") {
|
||||
const bundles = (await readdir(parent)).filter((file) => file.endsWith(".app"))
|
||||
|
||||
if (bundles.length !== 1) throw new Error(`Expected one .app bundle in ${parent}, found ${bundles.join(", ")}`)
|
||||
await writeUpdateConfig(path.join(parent, bundles[0], "Contents", "Resources"))
|
||||
await $`tar -cf ${path.join(out, `opencode-desktop-mac-${cli.cpu}.app.tar`)} -C ${parent} ${bundles[0]}`
|
||||
}
|
||||
|
||||
if (!app && os === "win") {
|
||||
await $`bunx electron-builder ${flags} --dir`
|
||||
await cp(path.join("dist", cli.cpu === "arm64" ? "win-arm64-unpacked" : "win-unpacked"), path.join(out, "app"), {
|
||||
recursive: true,
|
||||
})
|
||||
const unpacked = path.join("dist", cli.cpu === "arm64" ? "win-arm64-unpacked" : "win-unpacked")
|
||||
await writeUpdateConfig(path.join(unpacked, "resources"))
|
||||
await cp(unpacked, path.join(out, "app"), { recursive: true })
|
||||
}
|
||||
|
||||
// electron-builder writes resources/app-update.yml only for dmg, zip and nsis targets, not for --dir builds.
|
||||
// electron-updater reads its feed from that file, so write the one those targets would.
|
||||
async function writeUpdateConfig(resources: string) {
|
||||
const publish = getConfig().publish
|
||||
const name: string = (await Bun.file("package.json").json()).name
|
||||
await Bun.write(
|
||||
path.join(resources, "app-update.yml"),
|
||||
[
|
||||
`provider: ${publish.provider}`,
|
||||
`url: ${publish.url}`,
|
||||
`channel: ${publish.channel}`,
|
||||
`updaterCacheDirName: '${name.replace(/[/\\:*?"<>|]/g, "").toLowerCase()}-updater'`,
|
||||
].join("\n") + "\n",
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user