summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-09-10 04:23:43 -0400
committerDax Raad <[email protected]>2025-09-10 04:23:57 -0400
commit6960408ca226703cc5837eac0b4ffc6d077a0bdd (patch)
tree81d647e258bea76c39aa8cf300b346cdfec6b286
parentfa36195492196fb7e11c0f0fe2586dabd844129a (diff)
downloadopencode-6960408ca226703cc5837eac0b4ffc6d077a0bdd.tar.gz
opencode-6960408ca226703cc5837eac0b4ffc6d077a0bdd.zip
ci: bump version
-rw-r--r--.github/workflows/format.yml9
-rw-r--r--.github/workflows/publish.yml17
-rwxr-xr-xscript/publish.ts18
3 files changed, 25 insertions, 19 deletions
diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml
index e78702301..7a42fe823 100644
--- a/.github/workflows/format.yml
+++ b/.github/workflows/format.yml
@@ -20,10 +20,9 @@ jobs:
with:
bun-version: 1.2.21
- - name: Install dependencies
- run: bun install
-
- - name: Run format
- run: ./script/format.ts
+ - name: run
+ run: |
+ bun install
+ ./script/format.ts
env:
CI: true
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 645a7b504..51ffa4908 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -4,14 +4,14 @@ run-name: "${{ format('v{0}', inputs.version) }}"
on:
workflow_dispatch:
inputs:
- version:
- description: "Version to publish"
+ bump:
+ description: "Bump major, minor, or patch"
required: true
- type: string
- title:
- description: "Custom title for this run"
- required: false
- type: string
+ type: choice
+ options:
+ - major
+ - minor
+ - patch
concurrency: ${{ github.workflow }}-${{ github.ref }}
@@ -65,8 +65,9 @@ jobs:
- name: Publish
run: |
- OPENCODE_VERSION=${{ inputs.version }} ./script/publish.ts
+ ./script/publish.ts
env:
+ OPENCODE_BUMP: ${{ inputs.bump }}
GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }}
AUR_KEY: ${{ secrets.AUR_KEY }}
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
diff --git a/script/publish.ts b/script/publish.ts
index 9b3ea450e..4aedc9dc5 100755
--- a/script/publish.ts
+++ b/script/publish.ts
@@ -9,12 +9,18 @@ if (process.versions.bun !== "1.2.21") {
console.log("=== publishing ===\n")
const snapshot = process.env["OPENCODE_SNAPSHOT"] === "true"
-const version = snapshot
- ? `0.0.0-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}`
- : process.env["OPENCODE_VERSION"]
-if (!version) {
- throw new Error("OPENCODE_VERSION is required")
-}
+const version = await (async () => {
+ if (snapshot) return `0.0.0-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}`
+ const [major, minor, patch] = (await $`gh release list --limit 1 --json tagName --jq '.[0].tagName'`.text())
+ .trim()
+ .replace(/^v/, "")
+ .split(".")
+ .map((x) => Number(x) || 0)
+ const t = process.env["OPENCODE_BUMP"]?.toLowerCase()
+ if (t === "major") return `${major + 1}.0.0`
+ if (t === "minor") return `${major}.${minor + 1}.0`
+ return `${major}.${minor}.${patch + 1}`
+})()
process.env["OPENCODE_VERSION"] = version
console.log("version:", version)