sync
This commit is contained in:
parent
008ad54cb5
commit
6ae26dd0cf
3 changed files with 41 additions and 10 deletions
31
.github/workflows/publish.yml
vendored
31
.github/workflows/publish.yml
vendored
|
|
@ -4,6 +4,7 @@ run-name: "${{ format('release {0}', inputs.bump) }}"
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
|
- ci
|
||||||
- dev
|
- dev
|
||||||
- snapshot-*
|
- snapshot-*
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
@ -29,7 +30,22 @@ permissions:
|
||||||
packages: write
|
packages: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
version:
|
||||||
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||||
|
if: github.repository == 'anomalyco/opencode'
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: ./.github/actions/setup-bun
|
||||||
|
- id: version
|
||||||
|
run: |
|
||||||
|
./script/version.ts
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.version.outputs.version }}
|
||||||
|
|
||||||
|
build-cli:
|
||||||
|
needs: version
|
||||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||||
if: github.repository == 'anomalyco/opencode'
|
if: github.repository == 'anomalyco/opencode'
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -69,9 +85,10 @@ jobs:
|
||||||
git config --global user.name "opencode"
|
git config --global user.name "opencode"
|
||||||
git remote set-url origin https://x-access-token:${{ secrets.SST_GITHUB_TOKEN }}@github.com/${{ github.repository }}
|
git remote set-url origin https://x-access-token:${{ secrets.SST_GITHUB_TOKEN }}@github.com/${{ github.repository }}
|
||||||
|
|
||||||
- name: Publish
|
- name: Build
|
||||||
id: publish
|
id: build
|
||||||
run: ./script/publish-start.ts
|
run: |
|
||||||
|
./packages/script/build.ts
|
||||||
env:
|
env:
|
||||||
OPENCODE_BUMP: ${{ inputs.bump }}
|
OPENCODE_BUMP: ${{ inputs.bump }}
|
||||||
OPENCODE_VERSION: ${{ inputs.version }}
|
OPENCODE_VERSION: ${{ inputs.version }}
|
||||||
|
|
@ -86,12 +103,12 @@ jobs:
|
||||||
path: packages/opencode/dist
|
path: packages/opencode/dist
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
release: ${{ steps.publish.outputs.release }}
|
release: ${{ steps.build-cli.outputs.release }}
|
||||||
tag: ${{ steps.publish.outputs.tag }}
|
tag: ${{ steps.publish.outputs.tag }}
|
||||||
version: ${{ steps.publish.outputs.version }}
|
version: ${{ steps.publish.outputs.version }}
|
||||||
|
|
||||||
publish-tauri:
|
build-tauri:
|
||||||
needs: publish
|
needs: build
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,14 @@ import { fileURLToPath } from "url"
|
||||||
const dir = fileURLToPath(new URL("..", import.meta.url))
|
const dir = fileURLToPath(new URL("..", import.meta.url))
|
||||||
process.chdir(dir)
|
process.chdir(dir)
|
||||||
|
|
||||||
const { binaries } = await import("./build.ts")
|
const binaries: Record<string, string> = {}
|
||||||
|
for (const filepath of new Bun.Glob("*/package.json").scanSync({ cwd: "./dist" })) {
|
||||||
|
const pkg = await Bun.file(`./dist/${filepath}`).json()
|
||||||
|
binaries[pkg.name] = pkg.version
|
||||||
|
}
|
||||||
|
console.log("binaries", binaries)
|
||||||
|
const version = Object.values(binaries)[0]
|
||||||
|
|
||||||
{
|
{
|
||||||
const name = `${pkg.name}-${process.platform}-${process.arch}`
|
const name = `${pkg.name}-${process.platform}-${process.arch}`
|
||||||
console.log(`smoke test: running dist/${name}/bin/opencode --version`)
|
console.log(`smoke test: running dist/${name}/bin/opencode --version`)
|
||||||
|
|
@ -28,7 +35,7 @@ await Bun.file(`./dist/${pkg.name}/package.json`).write(
|
||||||
scripts: {
|
scripts: {
|
||||||
postinstall: "bun ./postinstall.mjs || node ./postinstall.mjs",
|
postinstall: "bun ./postinstall.mjs || node ./postinstall.mjs",
|
||||||
},
|
},
|
||||||
version: Script.version,
|
version: version,
|
||||||
optionalDependencies: binaries,
|
optionalDependencies: binaries,
|
||||||
},
|
},
|
||||||
null,
|
null,
|
||||||
|
|
@ -64,7 +71,7 @@ if (!Script.preview) {
|
||||||
|
|
||||||
const image = "ghcr.io/anomalyco/opencode"
|
const image = "ghcr.io/anomalyco/opencode"
|
||||||
const platforms = "linux/amd64,linux/arm64"
|
const platforms = "linux/amd64,linux/arm64"
|
||||||
const tags = [`${image}:${Script.version}`, `${image}:latest`]
|
const tags = [`${image}:${version}`, `${image}:latest`]
|
||||||
const tagFlags = tags.flatMap((t) => ["-t", t])
|
const tagFlags = tags.flatMap((t) => ["-t", t])
|
||||||
await $`docker buildx build --platform ${platforms} ${tagFlags} --push .`
|
await $`docker buildx build --platform ${platforms} ${tagFlags} --push .`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
7
script/version.ts
Normal file
7
script/version.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
import { Script } from "@opencode-ai/script"
|
||||||
|
|
||||||
|
let output = `version=${Script.version}\n`
|
||||||
|
|
||||||
|
if (process.env.GITHUB_OUTPUT) {
|
||||||
|
await Bun.write(process.env.GITHUB_OUTPUT, output)
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue