ci: bump version

This commit is contained in:
Dax Raad
2025-09-10 04:23:43 -04:00
parent fa36195492
commit 6960408ca2
3 changed files with 25 additions and 19 deletions

View File

@@ -20,10 +20,9 @@ jobs:
with: with:
bun-version: 1.2.21 bun-version: 1.2.21
- name: Install dependencies - name: run
run: bun install run: |
bun install
- name: Run format ./script/format.ts
run: ./script/format.ts
env: env:
CI: true CI: true

View File

@@ -4,14 +4,14 @@ run-name: "${{ format('v{0}', inputs.version) }}"
on: on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
version: bump:
description: "Version to publish" description: "Bump major, minor, or patch"
required: true required: true
type: string type: choice
title: options:
description: "Custom title for this run" - major
required: false - minor
type: string - patch
concurrency: ${{ github.workflow }}-${{ github.ref }} concurrency: ${{ github.workflow }}-${{ github.ref }}
@@ -65,8 +65,9 @@ jobs:
- name: Publish - name: Publish
run: | run: |
OPENCODE_VERSION=${{ inputs.version }} ./script/publish.ts ./script/publish.ts
env: env:
OPENCODE_BUMP: ${{ inputs.bump }}
GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }}
AUR_KEY: ${{ secrets.AUR_KEY }} AUR_KEY: ${{ secrets.AUR_KEY }}
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}

View File

@@ -9,12 +9,18 @@ if (process.versions.bun !== "1.2.21") {
console.log("=== publishing ===\n") console.log("=== publishing ===\n")
const snapshot = process.env["OPENCODE_SNAPSHOT"] === "true" const snapshot = process.env["OPENCODE_SNAPSHOT"] === "true"
const version = snapshot const version = await (async () => {
? `0.0.0-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}` if (snapshot) return `0.0.0-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}`
: process.env["OPENCODE_VERSION"] const [major, minor, patch] = (await $`gh release list --limit 1 --json tagName --jq '.[0].tagName'`.text())
if (!version) { .trim()
throw new Error("OPENCODE_VERSION is required") .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 process.env["OPENCODE_VERSION"] = version
console.log("version:", version) console.log("version:", version)