From 943fbf39a333ab4182e6f598c89f995d5063dbe1 Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Sat, 20 Dec 2025 02:22:17 +0800 Subject: ci: separate standalone publishing from dependent publishing (#5634) Co-authored-by: GitHub Action --- .github/workflows/publish.yml | 35 +++-- .opencode/agent/triage.md | 2 - packages/opencode/script/publish-registries.ts | 187 ++++++++++++++++++++++++ packages/opencode/script/publish.ts | 190 ------------------------- script/publish-complete.ts | 14 ++ script/publish-start.ts | 72 ++++++++++ script/publish.ts | 72 ---------- 7 files changed, 293 insertions(+), 279 deletions(-) create mode 100644 packages/opencode/script/publish-registries.ts create mode 100644 script/publish-complete.ts create mode 100755 script/publish-start.ts delete mode 100755 script/publish.ts diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b6da34dbc..163b8a01a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -41,18 +41,6 @@ jobs: - uses: ./.github/actions/setup-bun - - name: Setup SSH for AUR - if: inputs.bump || inputs.version - run: | - sudo apt-get update - sudo apt-get install -y pacman-package-manager - mkdir -p ~/.ssh - echo "${{ secrets.AUR_KEY }}" > ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa - git config --global user.email "opencode@sst.dev" - git config --global user.name "opencode" - ssh-keyscan -H aur.archlinux.org >> ~/.ssh/known_hosts || true - - name: Install OpenCode if: inputs.bump || inputs.version run: bun i -g opencode-ai@1.0.169 @@ -77,7 +65,7 @@ jobs: - name: Publish id: publish - run: ./script/publish.ts + run: ./script/publish-start.ts env: OPENCODE_BUMP: ${{ inputs.bump }} OPENCODE_VERSION: ${{ inputs.version }} @@ -212,6 +200,23 @@ jobs: fetch-depth: 0 ref: ${{ needs.publish.outputs.tagName }} - - run: gh release edit ${{ needs.publish.outputs.tagName }} --draft=false + - uses: ./.github/actions/setup-bun + + - name: Setup SSH for AUR + run: | + sudo apt-get update + sudo apt-get install -y pacman-package-manager + mkdir -p ~/.ssh + echo "${{ secrets.AUR_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + git config --global user.email "opencode@sst.dev" + git config --global user.name "opencode" + ssh-keyscan -H aur.archlinux.org >> ~/.ssh/known_hosts || true + + - run: ./script/publish-complete.ts env: - GH_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }} + OPENCODE_BUMP: ${{ inputs.bump }} + OPENCODE_VERSION: ${{ inputs.version }} + AUR_KEY: ${{ secrets.AUR_KEY }} + GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }} + OPENCODE_RELEASE_TAG: ${{ needs.publish.outputs.tagName }} diff --git a/.opencode/agent/triage.md b/.opencode/agent/triage.md index 36cec9bc3..b2db100e9 100644 --- a/.opencode/agent/triage.md +++ b/.opencode/agent/triage.md @@ -63,8 +63,6 @@ TUI issues potentially caused by our underlying TUI library: **Do not** add for general TUI bugs. ---- - When assigning to people here are the following rules: adamdotdev: diff --git a/packages/opencode/script/publish-registries.ts b/packages/opencode/script/publish-registries.ts new file mode 100644 index 000000000..85d87bd68 --- /dev/null +++ b/packages/opencode/script/publish-registries.ts @@ -0,0 +1,187 @@ +#!/usr/bin/env bun +import { $ } from "bun" +import { Script } from "@opencode-ai/script" + +if (!Script.preview) { + // Calculate SHA values + const arm64Sha = await $`sha256sum ./dist/opencode-linux-arm64.tar.gz | cut -d' ' -f1`.text().then((x) => x.trim()) + const x64Sha = await $`sha256sum ./dist/opencode-linux-x64.tar.gz | cut -d' ' -f1`.text().then((x) => x.trim()) + const macX64Sha = await $`sha256sum ./dist/opencode-darwin-x64.zip | cut -d' ' -f1`.text().then((x) => x.trim()) + const macArm64Sha = await $`sha256sum ./dist/opencode-darwin-arm64.zip | cut -d' ' -f1`.text().then((x) => x.trim()) + + const [pkgver, _subver = ""] = Script.version.split(/(-.*)/, 2) + + // arch + const binaryPkgbuild = [ + "# Maintainer: dax", + "# Maintainer: adam", + "", + "pkgname='opencode-bin'", + `pkgver=${pkgver}`, + `_subver=${_subver}`, + "options=('!debug' '!strip')", + "pkgrel=1", + "pkgdesc='The AI coding agent built for the terminal.'", + "url='https://github.com/sst/opencode'", + "arch=('aarch64' 'x86_64')", + "license=('MIT')", + "provides=('opencode')", + "conflicts=('opencode')", + "depends=('ripgrep')", + "", + `source_aarch64=("\${pkgname}_\${pkgver}_aarch64.tar.gz::https://github.com/sst/opencode/releases/download/v\${pkgver}\${_subver}/opencode-linux-arm64.tar.gz")`, + `sha256sums_aarch64=('${arm64Sha}')`, + + `source_x86_64=("\${pkgname}_\${pkgver}_x86_64.tar.gz::https://github.com/sst/opencode/releases/download/v\${pkgver}\${_subver}/opencode-linux-x64.tar.gz")`, + `sha256sums_x86_64=('${x64Sha}')`, + "", + "package() {", + ' install -Dm755 ./opencode "${pkgdir}/usr/bin/opencode"', + "}", + "", + ].join("\n") + + // Source-based PKGBUILD for opencode + const sourcePkgbuild = [ + "# Maintainer: dax", + "# Maintainer: adam", + "", + "pkgname='opencode'", + `pkgver=${pkgver}`, + `_subver=${_subver}`, + "options=('!debug' '!strip')", + "pkgrel=1", + "pkgdesc='The AI coding agent built for the terminal.'", + "url='https://github.com/sst/opencode'", + "arch=('aarch64' 'x86_64')", + "license=('MIT')", + "provides=('opencode')", + "conflicts=('opencode-bin')", + "depends=('ripgrep')", + "makedepends=('git' 'bun-bin' 'go')", + "", + `source=("opencode-\${pkgver}.tar.gz::https://github.com/sst/opencode/archive/v\${pkgver}\${_subver}.tar.gz")`, + `sha256sums=('SKIP')`, + "", + "build() {", + ` cd "opencode-\${pkgver}"`, + ` bun install`, + " cd ./packages/opencode", + ` OPENCODE_CHANNEL=latest OPENCODE_VERSION=${pkgver} bun run ./script/build.ts --single`, + "}", + "", + "package() {", + ` cd "opencode-\${pkgver}/packages/opencode"`, + ' mkdir -p "${pkgdir}/usr/bin"', + ' target_arch="x64"', + ' case "$CARCH" in', + ' x86_64) target_arch="x64" ;;', + ' aarch64) target_arch="arm64" ;;', + ' *) printf "unsupported architecture: %s\\n" "$CARCH" >&2 ; return 1 ;;', + " esac", + ' libc=""', + " if command -v ldd >/dev/null 2>&1; then", + " if ldd --version 2>&1 | grep -qi musl; then", + ' libc="-musl"', + " fi", + " fi", + ' if [ -z "$libc" ] && ls /lib/ld-musl-* >/dev/null 2>&1; then', + ' libc="-musl"', + " fi", + ' base=""', + ' if [ "$target_arch" = "x64" ]; then', + " if ! grep -qi avx2 /proc/cpuinfo 2>/dev/null; then", + ' base="-baseline"', + " fi", + " fi", + ' bin="dist/opencode-linux-${target_arch}${base}${libc}/bin/opencode"', + ' if [ ! -f "$bin" ]; then', + ' printf "unable to find binary for %s%s%s\\n" "$target_arch" "$base" "$libc" >&2', + " return 1", + " fi", + ' install -Dm755 "$bin" "${pkgdir}/usr/bin/opencode"', + "}", + "", + ].join("\n") + + for (const [pkg, pkgbuild] of [ + ["opencode-bin", binaryPkgbuild], + ["opencode", sourcePkgbuild], + ]) { + for (let i = 0; i < 30; i++) { + try { + await $`rm -rf ./dist/aur-${pkg}` + await $`git clone ssh://aur@aur.archlinux.org/${pkg}.git ./dist/aur-${pkg}` + await $`cd ./dist/aur-${pkg} && git checkout master` + await Bun.file(`./dist/aur-${pkg}/PKGBUILD`).write(pkgbuild) + await $`cd ./dist/aur-${pkg} && makepkg --printsrcinfo > .SRCINFO` + await $`cd ./dist/aur-${pkg} && git add PKGBUILD .SRCINFO` + await $`cd ./dist/aur-${pkg} && git commit -m "Update to v${Script.version}"` + await $`cd ./dist/aur-${pkg} && git push` + break + } catch (e) { + continue + } + } + } + + // Homebrew formula + const homebrewFormula = [ + "# typed: false", + "# frozen_string_literal: true", + "", + "# This file was generated by GoReleaser. DO NOT EDIT.", + "class Opencode < Formula", + ` desc "The AI coding agent built for the terminal."`, + ` homepage "https://github.com/sst/opencode"`, + ` version "${Script.version.split("-")[0]}"`, + "", + ` depends_on "ripgrep"`, + "", + " on_macos do", + " if Hardware::CPU.intel?", + ` url "https://github.com/sst/opencode/releases/download/v${Script.version}/opencode-darwin-x64.zip"`, + ` sha256 "${macX64Sha}"`, + "", + " def install", + ' bin.install "opencode"', + " end", + " end", + " if Hardware::CPU.arm?", + ` url "https://github.com/sst/opencode/releases/download/v${Script.version}/opencode-darwin-arm64.zip"`, + ` sha256 "${macArm64Sha}"`, + "", + " def install", + ' bin.install "opencode"', + " end", + " end", + " end", + "", + " on_linux do", + " if Hardware::CPU.intel? and Hardware::CPU.is_64_bit?", + ` url "https://github.com/sst/opencode/releases/download/v${Script.version}/opencode-linux-x64.tar.gz"`, + ` sha256 "${x64Sha}"`, + " def install", + ' bin.install "opencode"', + " end", + " end", + " if Hardware::CPU.arm? and Hardware::CPU.is_64_bit?", + ` url "https://github.com/sst/opencode/releases/download/v${Script.version}/opencode-linux-arm64.tar.gz"`, + ` sha256 "${arm64Sha}"`, + " def install", + ' bin.install "opencode"', + " end", + " end", + " end", + "end", + "", + "", + ].join("\n") + + await $`rm -rf ./dist/homebrew-tap` + await $`git clone https://${process.env["GITHUB_TOKEN"]}@github.com/sst/homebrew-tap.git ./dist/homebrew-tap` + await Bun.file("./dist/homebrew-tap/opencode.rb").write(homebrewFormula) + await $`cd ./dist/homebrew-tap && git add opencode.rb` + await $`cd ./dist/homebrew-tap && git commit -m "Update to v${Script.version}"` + await $`cd ./dist/homebrew-tap && git push` +} diff --git a/packages/opencode/script/publish.ts b/packages/opencode/script/publish.ts index 72632992f..9b93caf11 100755 --- a/packages/opencode/script/publish.ts +++ b/packages/opencode/script/publish.ts @@ -53,196 +53,6 @@ for (const tag of tags) { } if (!Script.preview) { - for (const key of Object.keys(binaries)) { - if (key.includes("linux")) { - await $`cd dist/${key}/bin && tar -czf ../../${key}.tar.gz *` - } else { - await $`cd dist/${key}/bin && zip -r ../../${key}.zip *` - } - } - - // Calculate SHA values - const arm64Sha = await $`sha256sum ./dist/opencode-linux-arm64.tar.gz | cut -d' ' -f1`.text().then((x) => x.trim()) - const x64Sha = await $`sha256sum ./dist/opencode-linux-x64.tar.gz | cut -d' ' -f1`.text().then((x) => x.trim()) - const macX64Sha = await $`sha256sum ./dist/opencode-darwin-x64.zip | cut -d' ' -f1`.text().then((x) => x.trim()) - const macArm64Sha = await $`sha256sum ./dist/opencode-darwin-arm64.zip | cut -d' ' -f1`.text().then((x) => x.trim()) - - const [pkgver, _subver = ""] = Script.version.split(/(-.*)/, 2) - - // arch - const binaryPkgbuild = [ - "# Maintainer: dax", - "# Maintainer: adam", - "", - "pkgname='opencode-bin'", - `pkgver=${pkgver}`, - `_subver=${_subver}`, - "options=('!debug' '!strip')", - "pkgrel=1", - "pkgdesc='The AI coding agent built for the terminal.'", - "url='https://github.com/sst/opencode'", - "arch=('aarch64' 'x86_64')", - "license=('MIT')", - "provides=('opencode')", - "conflicts=('opencode')", - "depends=('ripgrep')", - "", - `source_aarch64=("\${pkgname}_\${pkgver}_aarch64.tar.gz::https://github.com/sst/opencode/releases/download/v\${pkgver}\${_subver}/opencode-linux-arm64.tar.gz")`, - `sha256sums_aarch64=('${arm64Sha}')`, - - `source_x86_64=("\${pkgname}_\${pkgver}_x86_64.tar.gz::https://github.com/sst/opencode/releases/download/v\${pkgver}\${_subver}/opencode-linux-x64.tar.gz")`, - `sha256sums_x86_64=('${x64Sha}')`, - "", - "package() {", - ' install -Dm755 ./opencode "${pkgdir}/usr/bin/opencode"', - "}", - "", - ].join("\n") - - // Source-based PKGBUILD for opencode - const sourcePkgbuild = [ - "# Maintainer: dax", - "# Maintainer: adam", - "", - "pkgname='opencode'", - `pkgver=${pkgver}`, - `_subver=${_subver}`, - "options=('!debug' '!strip')", - "pkgrel=1", - "pkgdesc='The AI coding agent built for the terminal.'", - "url='https://github.com/sst/opencode'", - "arch=('aarch64' 'x86_64')", - "license=('MIT')", - "provides=('opencode')", - "conflicts=('opencode-bin')", - "depends=('ripgrep')", - "makedepends=('git' 'bun-bin' 'go')", - "", - `source=("opencode-\${pkgver}.tar.gz::https://github.com/sst/opencode/archive/v\${pkgver}\${_subver}.tar.gz")`, - `sha256sums=('SKIP')`, - "", - "build() {", - ` cd "opencode-\${pkgver}"`, - ` bun install`, - " cd ./packages/opencode", - ` OPENCODE_CHANNEL=latest OPENCODE_VERSION=${pkgver} bun run ./script/build.ts --single`, - "}", - "", - "package() {", - ` cd "opencode-\${pkgver}/packages/opencode"`, - ' mkdir -p "${pkgdir}/usr/bin"', - ' target_arch="x64"', - ' case "$CARCH" in', - ' x86_64) target_arch="x64" ;;', - ' aarch64) target_arch="arm64" ;;', - ' *) printf "unsupported architecture: %s\\n" "$CARCH" >&2 ; return 1 ;;', - " esac", - ' libc=""', - " if command -v ldd >/dev/null 2>&1; then", - " if ldd --version 2>&1 | grep -qi musl; then", - ' libc="-musl"', - " fi", - " fi", - ' if [ -z "$libc" ] && ls /lib/ld-musl-* >/dev/null 2>&1; then', - ' libc="-musl"', - " fi", - ' base=""', - ' if [ "$target_arch" = "x64" ]; then', - " if ! grep -qi avx2 /proc/cpuinfo 2>/dev/null; then", - ' base="-baseline"', - " fi", - " fi", - ' bin="dist/opencode-linux-${target_arch}${base}${libc}/bin/opencode"', - ' if [ ! -f "$bin" ]; then', - ' printf "unable to find binary for %s%s%s\\n" "$target_arch" "$base" "$libc" >&2', - " return 1", - " fi", - ' install -Dm755 "$bin" "${pkgdir}/usr/bin/opencode"', - "}", - "", - ].join("\n") - - for (const [pkg, pkgbuild] of [ - ["opencode-bin", binaryPkgbuild], - ["opencode", sourcePkgbuild], - ]) { - for (let i = 0; i < 30; i++) { - try { - await $`rm -rf ./dist/aur-${pkg}` - await $`git clone ssh://aur@aur.archlinux.org/${pkg}.git ./dist/aur-${pkg}` - await $`cd ./dist/aur-${pkg} && git checkout master` - await Bun.file(`./dist/aur-${pkg}/PKGBUILD`).write(pkgbuild) - await $`cd ./dist/aur-${pkg} && makepkg --printsrcinfo > .SRCINFO` - await $`cd ./dist/aur-${pkg} && git add PKGBUILD .SRCINFO` - await $`cd ./dist/aur-${pkg} && git commit -m "Update to v${Script.version}"` - await $`cd ./dist/aur-${pkg} && git push` - break - } catch (e) { - continue - } - } - } - - // Homebrew formula - const homebrewFormula = [ - "# typed: false", - "# frozen_string_literal: true", - "", - "# This file was generated by GoReleaser. DO NOT EDIT.", - "class Opencode < Formula", - ` desc "The AI coding agent built for the terminal."`, - ` homepage "https://github.com/sst/opencode"`, - ` version "${Script.version.split("-")[0]}"`, - "", - ` depends_on "ripgrep"`, - "", - " on_macos do", - " if Hardware::CPU.intel?", - ` url "https://github.com/sst/opencode/releases/download/v${Script.version}/opencode-darwin-x64.zip"`, - ` sha256 "${macX64Sha}"`, - "", - " def install", - ' bin.install "opencode"', - " end", - " end", - " if Hardware::CPU.arm?", - ` url "https://github.com/sst/opencode/releases/download/v${Script.version}/opencode-darwin-arm64.zip"`, - ` sha256 "${macArm64Sha}"`, - "", - " def install", - ' bin.install "opencode"', - " end", - " end", - " end", - "", - " on_linux do", - " if Hardware::CPU.intel? and Hardware::CPU.is_64_bit?", - ` url "https://github.com/sst/opencode/releases/download/v${Script.version}/opencode-linux-x64.tar.gz"`, - ` sha256 "${x64Sha}"`, - " def install", - ' bin.install "opencode"', - " end", - " end", - " if Hardware::CPU.arm? and Hardware::CPU.is_64_bit?", - ` url "https://github.com/sst/opencode/releases/download/v${Script.version}/opencode-linux-arm64.tar.gz"`, - ` sha256 "${arm64Sha}"`, - " def install", - ' bin.install "opencode"', - " end", - " end", - " end", - "end", - "", - "", - ].join("\n") - - await $`rm -rf ./dist/homebrew-tap` - await $`git clone https://${process.env["GITHUB_TOKEN"]}@github.com/sst/homebrew-tap.git ./dist/homebrew-tap` - await Bun.file("./dist/homebrew-tap/opencode.rb").write(homebrewFormula) - await $`cd ./dist/homebrew-tap && git add opencode.rb` - await $`cd ./dist/homebrew-tap && git commit -m "Update to v${Script.version}"` - await $`cd ./dist/homebrew-tap && git push` - const image = "ghcr.io/sst/opencode" const platforms = "linux/amd64,linux/arm64" const tags = [`${image}:${Script.version}`, `${image}:latest`] diff --git a/script/publish-complete.ts b/script/publish-complete.ts new file mode 100644 index 000000000..aae1a3524 --- /dev/null +++ b/script/publish-complete.ts @@ -0,0 +1,14 @@ +#!/usr/bin/env bun + +import { Script } from "@opencode-ai/script" +import { $ } from "bun" + +if (!Script.preview) { + await $`gh release edit ${process.env.OPENCODE_RELEASE_TAG} --draft=false` +} + +await $`bun install` + +await $`gh release download --pattern "opencode-linux-*64.tar.gz" --pattern "opencode-darwin-*64.zip" -D dist` + +await import(`../packages/opencode/script/publish-registries.ts`) diff --git a/script/publish-start.ts b/script/publish-start.ts new file mode 100755 index 000000000..d11b435b4 --- /dev/null +++ b/script/publish-start.ts @@ -0,0 +1,72 @@ +#!/usr/bin/env bun + +import { $ } from "bun" +import { Script } from "@opencode-ai/script" +import { generateChangelog } from "./changelog" + +let notes = "" + +console.log("=== publishing ===\n") + +if (!Script.preview) { + const previous = await fetch("https://registry.npmjs.org/opencode-ai/latest") + .then((res) => { + if (!res.ok) throw new Error(res.statusText) + return res.json() + }) + .then((data: any) => data.version) + + console.log("generating changelog since " + previous) + notes = await generateChangelog(`v${previous}`, "HEAD") + console.log("---- Generated Changelog ----") + console.log(notes) + console.log("-----------------------------") +} + +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"))) + +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) +} + +const extensionToml = new URL("../packages/extensions/zed/extension.toml", import.meta.url).pathname +let toml = await Bun.file(extensionToml).text() +toml = toml.replace(/^version = "[^"]+"/m, `version = "${Script.version}"`) +toml = toml.replaceAll(/releases\/download\/v[^/]+\//g, `releases/download/v${Script.version}/`) +console.log("updated:", extensionToml) +await Bun.file(extensionToml).write(toml) + +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 (!Script.preview) { + await $`git commit -am "release: v${Script.version}"` + await $`git tag v${Script.version}` + await $`git fetch origin` + await $`git cherry-pick HEAD..origin/dev`.nothrow() + await $`git push origin HEAD --tags --no-verify --force-with-lease` + await new Promise((resolve) => setTimeout(resolve, 5_000)) + await $`gh release create v${Script.version} -d --title "v${Script.version}" --notes ${notes || "No notable changes"} ./packages/opencode/dist/*.zip ./packages/opencode/dist/*.tar.gz` + const release = await $`gh release view v${Script.version} --json id,tagName`.json() + if (process.env.GITHUB_OUTPUT) { + await Bun.write(process.env.GITHUB_OUTPUT, `releaseId=${release.id}\ntagName=${release.tagName}\n`) + } +} diff --git a/script/publish.ts b/script/publish.ts deleted file mode 100755 index d11b435b4..000000000 --- a/script/publish.ts +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env bun - -import { $ } from "bun" -import { Script } from "@opencode-ai/script" -import { generateChangelog } from "./changelog" - -let notes = "" - -console.log("=== publishing ===\n") - -if (!Script.preview) { - const previous = await fetch("https://registry.npmjs.org/opencode-ai/latest") - .then((res) => { - if (!res.ok) throw new Error(res.statusText) - return res.json() - }) - .then((data: any) => data.version) - - console.log("generating changelog since " + previous) - notes = await generateChangelog(`v${previous}`, "HEAD") - console.log("---- Generated Changelog ----") - console.log(notes) - console.log("-----------------------------") -} - -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"))) - -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) -} - -const extensionToml = new URL("../packages/extensions/zed/extension.toml", import.meta.url).pathname -let toml = await Bun.file(extensionToml).text() -toml = toml.replace(/^version = "[^"]+"/m, `version = "${Script.version}"`) -toml = toml.replaceAll(/releases\/download\/v[^/]+\//g, `releases/download/v${Script.version}/`) -console.log("updated:", extensionToml) -await Bun.file(extensionToml).write(toml) - -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 (!Script.preview) { - await $`git commit -am "release: v${Script.version}"` - await $`git tag v${Script.version}` - await $`git fetch origin` - await $`git cherry-pick HEAD..origin/dev`.nothrow() - await $`git push origin HEAD --tags --no-verify --force-with-lease` - await new Promise((resolve) => setTimeout(resolve, 5_000)) - await $`gh release create v${Script.version} -d --title "v${Script.version}" --notes ${notes || "No notable changes"} ./packages/opencode/dist/*.zip ./packages/opencode/dist/*.tar.gz` - const release = await $`gh release view v${Script.version} --json id,tagName`.json() - if (process.env.GITHUB_OUTPUT) { - await Bun.write(process.env.GITHUB_OUTPUT, `releaseId=${release.id}\ntagName=${release.tagName}\n`) - } -} -- cgit v1.2.3