diff options
| author | Dax Raad <[email protected]> | 2025-09-22 01:45:23 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-09-22 01:45:23 -0400 |
| commit | 288c977596ed3f6eaf2149fdcabffa415c8e5e50 (patch) | |
| tree | a01325a1a0b4889eb66e1e4e937d76d6a3ddde16 /packages | |
| parent | 6b799b304c2bb07e20ee0746d9ea8ada0f3c1571 (diff) | |
| download | opencode-288c977596ed3f6eaf2149fdcabffa415c8e5e50.tar.gz opencode-288c977596ed3f6eaf2149fdcabffa415c8e5e50.zip | |
ci: snapshot builds
Diffstat (limited to 'packages')
| -rwxr-xr-x | packages/opencode/script/publish.ts | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/packages/opencode/script/publish.ts b/packages/opencode/script/publish.ts index a0c3e1390..996ec46e7 100755 --- a/packages/opencode/script/publish.ts +++ b/packages/opencode/script/publish.ts @@ -5,10 +5,14 @@ import { $ } from "bun" import pkg from "../package.json" -const dry = process.env["OPENCODE_DRY"] === "true" -const version = process.env["OPENCODE_VERSION"]! const snapshot = process.env["OPENCODE_SNAPSHOT"] === "true" -const npmTag = snapshot ? "snapshot" : "latest" +let version = process.env["OPENCODE_VERSION"] +const tag = process.env["OPENCODE_TAG"] ?? (snapshot ? "snapshot" : "latest") +if (!version && snapshot) { + version = `0.0.0-${tag}-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}` + process.env["OPENCODE_VERSION"] = version +} +if (!version) throw new Error("OPENCODE_VERSION is required") console.log(`publishing ${version}`) @@ -41,12 +45,10 @@ await Bun.file(`./dist/${pkg.name}/package.json`).write( 2, ), ) -if (!dry) { - for (const [name] of Object.entries(binaries)) { - await $`cd dist/${name} && chmod 777 -R . && bun publish --access public --tag ${npmTag}` - } - await $`cd ./dist/${pkg.name} && bun publish --access public --tag ${npmTag}` +for (const [name] of Object.entries(binaries)) { + await $`cd dist/${name} && chmod 777 -R . && bun publish --access public --tag ${tag}` } +await $`cd ./dist/${pkg.name} && bun publish --access public --tag ${tag}` if (!snapshot) { for (const key of Object.keys(binaries)) { @@ -142,7 +144,7 @@ if (!snapshot) { 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${version}"` - if (!dry) await $`cd ./dist/aur-${pkg} && git push` + await $`cd ./dist/aur-${pkg} && git push` } // Homebrew formula @@ -201,5 +203,5 @@ if (!snapshot) { 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` + await $`cd ./dist/homebrew-tap && git push` } |
