The open source coding agent.
TypeScript
homebrew
Dax Raad2bee48a9bcc2
diff --git a/packages/opencode/script/PKGBUILD.template b/packages/opencode/script/PKGBUILD.templatedeleted file mode 100644index c698849910a..00000000000--- a/packages/opencode/script/PKGBUILD.template+++ /dev/null@@ -1,24 +0,0 @@-# Maintainer: dax-# Maintainer: adam--pkgname='opencode-bin'-pkgver={{VERSION}}-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=('fzf' 'ripgrep')--source_aarch64=("${pkgname}_${pkgver}_aarch64.zip::{{ARM64_URL}}")-sha256sums_aarch64=('{{ARM64_SHA}}')--source_x86_64=("${pkgname}_${pkgver}_x86_64.zip::{{X64_URL}}")-sha256sums_x86_64=('{{X64_SHA}}')--package() {- install -Dm755 ./opencode "${pkgdir}/usr/bin/opencode"-}diff --git a/packages/opencode/script/publish.ts b/packages/opencode/script/publish.tsindex 81b27797265..40818d11a47 100755--- a/packages/opencode/script/publish.ts+++ b/packages/opencode/script/publish.ts@@ -118,30 +118,52 @@ if (!snapshot) {if (!dry)await $`gh release create v${version} --title "v${version}" --notes ${notes} ./dist/*.zip`+ // Calculate SHA values+ const arm64Sha =+ await $`sha256sum ./dist/opencode-linux-arm64.zip | cut -d' ' -f1`+ .text()+ .then((x) => x.trim())+ const x64Sha =+ await $`sha256sum ./dist/opencode-linux-x64.zip | 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())+// AUR package- const pkgbuildTemplate = await Bun.file("./script/PKGBUILD.template").text()- const pkgbuild = pkgbuildTemplate- .replace("{{VERSION}}", version.split("-")[0])- .replace(- "{{ARM64_URL}}",- `https://github.com/sst/opencode/releases/download/v${version}/opencode-linux-arm64.zip`,- )- .replace(- "{{ARM64_SHA}}",- await $`sha256sum ./dist/opencode-linux-arm64.zip | cut -d' ' -f1`- .text()- .then((x) => x.trim()),- )- .replace(- "{{X64_URL}}",- `https://github.com/sst/opencode/releases/download/v${version}/opencode-linux-x64.zip`,- )- .replace(- "{{X64_SHA}}",- await $`sha256sum ./dist/opencode-linux-x64.zip | cut -d' ' -f1`- .text()- .then((x) => x.trim()),- )+ const pkgbuild = [+ "# Maintainer: dax",+ "# Maintainer: adam",+ "",+ "pkgname='opencode-bin'",+ `pkgver=${version.split("-")[0]}`,+ "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=('fzf' 'ripgrep')",+ "",+ `source_aarch64=("\${pkgname}_\${pkgver}_aarch64.zip::https://github.com/sst/opencode/releases/download/v${version}/opencode-linux-arm64.zip")`,+ `sha256sums_aarch64=('${arm64Sha}')`,+ "",+ `source_x86_64=("\${pkgname}_\${pkgver}_x86_64.zip::https://github.com/sst/opencode/releases/download/v${version}/opencode-linux-x64.zip")`,+ `sha256sums_x86_64=('${x64Sha}')`,+ "",+ "package() {",+ ' install -Dm755 ./opencode "${pkgdir}/usr/bin/opencode"',+ "}",+ "",+ ].join("\n")await $`rm -rf ./dist/aur-opencode-bin`@@ -151,4 +173,62 @@ if (!snapshot) {await $`cd ./dist/aur-opencode-bin && git add PKGBUILD .SRCINFO`await $`cd ./dist/aur-opencode-bin && git commit -m "Update to v${version}"`if (!dry) await $`cd ./dist/aur-opencode-bin && git push`++ // 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 "${version.split("-")[0]}"`,+ "",+ " on_macos do",+ " if Hardware::CPU.intel?",+ ` url "https://github.com/sst/opencode/releases/download/v${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${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${version}/opencode-linux-x64.zip"`,+ ` 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${version}/opencode-linux-arm64.zip"`,+ ` sha256 "${arm64Sha}"`,+ " def install",+ ' bin.install "opencode"',+ " end",+ " end",+ " end",+ "end",+ "",+ "",+ ].join("\n")++ await $`rm -rf ./dist/homebrew-tap`+ await $`git clone [email protected]: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${version}"`+ if (!dry) await $`cd ./dist/homebrew-tap && git push`}