163
.github/workflows/publish.yml
vendored
163
.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,56 +30,46 @@ permissions:
|
|||||||
packages: write
|
packages: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
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:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 1
|
||||||
|
- uses: ./.github/actions/setup-bun
|
||||||
|
- id: version
|
||||||
|
run: |
|
||||||
|
./script/version.ts
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
OPENCODE_BUMP: ${{ inputs.bump }}
|
||||||
|
OPENCODE_VERSION: ${{ inputs.version }}
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.version.outputs.version }}
|
||||||
|
release: ${{ steps.version.outputs.release }}
|
||||||
|
tag: ${{ steps.version.outputs.tag }}
|
||||||
|
|
||||||
- run: git fetch --force --tags
|
build-cli:
|
||||||
|
needs: version
|
||||||
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||||
|
if: github.repository == 'anomalyco/opencode'
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
fetch-tags: true
|
||||||
|
|
||||||
- uses: ./.github/actions/setup-bun
|
- uses: ./.github/actions/setup-bun
|
||||||
|
|
||||||
- name: Install OpenCode
|
- name: Build
|
||||||
if: inputs.bump || inputs.version
|
id: build
|
||||||
run: bun i -g opencode-ai@1.0.169
|
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.repository_owner }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: "24"
|
|
||||||
registry-url: "https://registry.npmjs.org"
|
|
||||||
|
|
||||||
- name: Setup Git Identity
|
|
||||||
run: |
|
run: |
|
||||||
git config --global user.email "opencode@sst.dev"
|
./packages/opencode/script/build.ts
|
||||||
git config --global user.name "opencode"
|
|
||||||
git remote set-url origin https://x-access-token:${{ secrets.SST_GITHUB_TOKEN }}@github.com/${{ github.repository }}
|
|
||||||
|
|
||||||
- name: Publish
|
|
||||||
id: publish
|
|
||||||
run: ./script/publish-start.ts
|
|
||||||
env:
|
env:
|
||||||
OPENCODE_BUMP: ${{ inputs.bump }}
|
OPENCODE_VERSION: ${{ needs.version.outputs.version }}
|
||||||
OPENCODE_VERSION: ${{ inputs.version }}
|
OPENCODE_RELEASE: ${{ needs.version.outputs.release }}
|
||||||
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
AUR_KEY: ${{ secrets.AUR_KEY }}
|
|
||||||
GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }}
|
|
||||||
NPM_CONFIG_PROVENANCE: false
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@@ -86,12 +77,12 @@ jobs:
|
|||||||
path: packages/opencode/dist
|
path: packages/opencode/dist
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
release: ${{ steps.publish.outputs.release }}
|
version: ${{ needs.version.outputs.version }}
|
||||||
tag: ${{ steps.publish.outputs.tag }}
|
|
||||||
version: ${{ steps.publish.outputs.version }}
|
|
||||||
|
|
||||||
publish-tauri:
|
build-tauri:
|
||||||
needs: publish
|
needs:
|
||||||
|
- build-cli
|
||||||
|
- version
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
@@ -111,8 +102,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 1
|
||||||
ref: ${{ needs.publish.outputs.tag }}
|
fetch-tags: true
|
||||||
|
|
||||||
- uses: apple-actions/import-codesign-certs@v2
|
- uses: apple-actions/import-codesign-certs@v2
|
||||||
if: ${{ runner.os == 'macOS' }}
|
if: ${{ runner.os == 'macOS' }}
|
||||||
@@ -134,8 +125,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "${{ secrets.APPLE_API_KEY_PATH }}" > $RUNNER_TEMP/apple-api-key.p8
|
echo "${{ secrets.APPLE_API_KEY_PATH }}" > $RUNNER_TEMP/apple-api-key.p8
|
||||||
|
|
||||||
- run: git fetch --force --tags
|
|
||||||
|
|
||||||
- uses: ./.github/actions/setup-bun
|
- uses: ./.github/actions/setup-bun
|
||||||
|
|
||||||
- name: install dependencies (ubuntu only)
|
- name: install dependencies (ubuntu only)
|
||||||
@@ -160,10 +149,7 @@ jobs:
|
|||||||
bun ./scripts/prepare.ts
|
bun ./scripts/prepare.ts
|
||||||
env:
|
env:
|
||||||
OPENCODE_VERSION: ${{ needs.publish.outputs.version }}
|
OPENCODE_VERSION: ${{ needs.publish.outputs.version }}
|
||||||
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
||||||
GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }}
|
||||||
AUR_KEY: ${{ secrets.AUR_KEY }}
|
|
||||||
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
|
|
||||||
RUST_TARGET: ${{ matrix.settings.target }}
|
RUST_TARGET: ${{ matrix.settings.target }}
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
GITHUB_RUN_ID: ${{ github.run_id }}
|
GITHUB_RUN_ID: ${{ github.run_id }}
|
||||||
@@ -177,22 +163,18 @@ jobs:
|
|||||||
cargo tauri --version
|
cargo tauri --version
|
||||||
|
|
||||||
- name: Build and upload artifacts
|
- name: Build and upload artifacts
|
||||||
uses: Wandalen/wretry.action@v3
|
uses: tauri-apps/tauri-action@390cbe447412ced1303d35abe75287949e43437a
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
with:
|
with:
|
||||||
attempt_limit: 3
|
projectPath: packages/desktop
|
||||||
attempt_delay: 10000
|
uploadWorkflowArtifacts: true
|
||||||
action: tauri-apps/tauri-action@390cbe447412ced1303d35abe75287949e43437a
|
tauriScript: ${{ (contains(matrix.settings.host, 'ubuntu') && 'cargo tauri') || '' }}
|
||||||
with: |
|
args: --target ${{ matrix.settings.target }} --config ./src-tauri/tauri.prod.conf.json --verbose
|
||||||
projectPath: packages/desktop
|
updaterJsonPreferNsis: true
|
||||||
uploadWorkflowArtifacts: true
|
releaseId: ${{ needs.version.outputs.release }}
|
||||||
tauriScript: ${{ (contains(matrix.settings.host, 'ubuntu') && 'cargo tauri') || '' }}
|
tagName: ${{ needs.version.outputs.tag }}
|
||||||
args: --target ${{ matrix.settings.target }} --config ./src-tauri/tauri.prod.conf.json --verbose
|
releaseDraft: true
|
||||||
updaterJsonPreferNsis: true
|
releaseAssetNamePattern: opencode-desktop-[platform]-[arch][ext]
|
||||||
releaseId: ${{ needs.publish.outputs.release }}
|
|
||||||
tagName: ${{ needs.publish.outputs.tag }}
|
|
||||||
releaseAssetNamePattern: opencode-desktop-[platform]-[arch][ext]
|
|
||||||
releaseDraft: true
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
TAURI_BUNDLER_NEW_APPIMAGE_FORMAT: true
|
TAURI_BUNDLER_NEW_APPIMAGE_FORMAT: true
|
||||||
@@ -205,20 +187,52 @@ jobs:
|
|||||||
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
|
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
|
||||||
APPLE_API_KEY_PATH: ${{ runner.temp }}/apple-api-key.p8
|
APPLE_API_KEY_PATH: ${{ runner.temp }}/apple-api-key.p8
|
||||||
|
|
||||||
publish-release:
|
publish:
|
||||||
needs:
|
needs:
|
||||||
- publish
|
- version
|
||||||
- publish-tauri
|
- build-cli
|
||||||
if: needs.publish.outputs.tag
|
- build-tauri
|
||||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 1
|
||||||
ref: ${{ needs.publish.outputs.tag }}
|
|
||||||
|
- name: Install OpenCode
|
||||||
|
if: inputs.bump || inputs.version
|
||||||
|
run: bun i -g opencode-ai
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "24"
|
||||||
|
registry-url: "https://registry.npmjs.org"
|
||||||
|
|
||||||
|
- name: Setup Git Identity
|
||||||
|
run: |
|
||||||
|
git config --global user.email "opencode@sst.dev"
|
||||||
|
git config --global user.name "opencode"
|
||||||
|
git remote set-url origin https://x-access-token:${{ secrets.SST_GITHUB_TOKEN }}@github.com/${{ github.repository }}
|
||||||
|
|
||||||
- uses: ./.github/actions/setup-bun
|
- uses: ./.github/actions/setup-bun
|
||||||
|
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: opencode-cli
|
||||||
|
path: packages/opencode/dist
|
||||||
|
|
||||||
- name: Setup SSH for AUR
|
- name: Setup SSH for AUR
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
@@ -230,8 +244,11 @@ jobs:
|
|||||||
git config --global user.name "opencode"
|
git config --global user.name "opencode"
|
||||||
ssh-keyscan -H aur.archlinux.org >> ~/.ssh/known_hosts || true
|
ssh-keyscan -H aur.archlinux.org >> ~/.ssh/known_hosts || true
|
||||||
|
|
||||||
- run: ./script/publish-complete.ts
|
- run: ./script/publish.ts
|
||||||
env:
|
env:
|
||||||
OPENCODE_VERSION: ${{ needs.publish.outputs.version }}
|
OPENCODE_VERSION: ${{ needs.version.outputs.version }}
|
||||||
|
OPENCODE_RELEASE: ${{ needs.version.outputs.release }}
|
||||||
AUR_KEY: ${{ secrets.AUR_KEY }}
|
AUR_KEY: ${{ secrets.AUR_KEY }}
|
||||||
GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }}
|
||||||
|
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
|
||||||
|
NPM_CONFIG_PROVENANCE: false
|
||||||
|
|||||||
30
bun.lock
30
bun.lock
@@ -23,7 +23,7 @@
|
|||||||
},
|
},
|
||||||
"packages/app": {
|
"packages/app": {
|
||||||
"name": "@opencode-ai/app",
|
"name": "@opencode-ai/app",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@kobalte/core": "catalog:",
|
"@kobalte/core": "catalog:",
|
||||||
"@opencode-ai/sdk": "workspace:*",
|
"@opencode-ai/sdk": "workspace:*",
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
},
|
},
|
||||||
"packages/console/app": {
|
"packages/console/app": {
|
||||||
"name": "@opencode-ai/console-app",
|
"name": "@opencode-ai/console-app",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@cloudflare/vite-plugin": "1.15.2",
|
"@cloudflare/vite-plugin": "1.15.2",
|
||||||
"@ibm/plex": "6.4.1",
|
"@ibm/plex": "6.4.1",
|
||||||
@@ -107,7 +107,7 @@
|
|||||||
},
|
},
|
||||||
"packages/console/core": {
|
"packages/console/core": {
|
||||||
"name": "@opencode-ai/console-core",
|
"name": "@opencode-ai/console-core",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-sts": "3.782.0",
|
"@aws-sdk/client-sts": "3.782.0",
|
||||||
"@jsx-email/render": "1.1.1",
|
"@jsx-email/render": "1.1.1",
|
||||||
@@ -134,7 +134,7 @@
|
|||||||
},
|
},
|
||||||
"packages/console/function": {
|
"packages/console/function": {
|
||||||
"name": "@opencode-ai/console-function",
|
"name": "@opencode-ai/console-function",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ai-sdk/anthropic": "2.0.0",
|
"@ai-sdk/anthropic": "2.0.0",
|
||||||
"@ai-sdk/openai": "2.0.2",
|
"@ai-sdk/openai": "2.0.2",
|
||||||
@@ -158,7 +158,7 @@
|
|||||||
},
|
},
|
||||||
"packages/console/mail": {
|
"packages/console/mail": {
|
||||||
"name": "@opencode-ai/console-mail",
|
"name": "@opencode-ai/console-mail",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jsx-email/all": "2.2.3",
|
"@jsx-email/all": "2.2.3",
|
||||||
"@jsx-email/cli": "1.4.3",
|
"@jsx-email/cli": "1.4.3",
|
||||||
@@ -182,7 +182,7 @@
|
|||||||
},
|
},
|
||||||
"packages/desktop": {
|
"packages/desktop": {
|
||||||
"name": "@opencode-ai/desktop",
|
"name": "@opencode-ai/desktop",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@opencode-ai/app": "workspace:*",
|
"@opencode-ai/app": "workspace:*",
|
||||||
"@opencode-ai/ui": "workspace:*",
|
"@opencode-ai/ui": "workspace:*",
|
||||||
@@ -213,7 +213,7 @@
|
|||||||
},
|
},
|
||||||
"packages/enterprise": {
|
"packages/enterprise": {
|
||||||
"name": "@opencode-ai/enterprise",
|
"name": "@opencode-ai/enterprise",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@opencode-ai/ui": "workspace:*",
|
"@opencode-ai/ui": "workspace:*",
|
||||||
"@opencode-ai/util": "workspace:*",
|
"@opencode-ai/util": "workspace:*",
|
||||||
@@ -242,7 +242,7 @@
|
|||||||
},
|
},
|
||||||
"packages/function": {
|
"packages/function": {
|
||||||
"name": "@opencode-ai/function",
|
"name": "@opencode-ai/function",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@octokit/auth-app": "8.0.1",
|
"@octokit/auth-app": "8.0.1",
|
||||||
"@octokit/rest": "catalog:",
|
"@octokit/rest": "catalog:",
|
||||||
@@ -258,7 +258,7 @@
|
|||||||
},
|
},
|
||||||
"packages/opencode": {
|
"packages/opencode": {
|
||||||
"name": "opencode",
|
"name": "opencode",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"bin": {
|
"bin": {
|
||||||
"opencode": "./bin/opencode",
|
"opencode": "./bin/opencode",
|
||||||
},
|
},
|
||||||
@@ -362,7 +362,7 @@
|
|||||||
},
|
},
|
||||||
"packages/plugin": {
|
"packages/plugin": {
|
||||||
"name": "@opencode-ai/plugin",
|
"name": "@opencode-ai/plugin",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@opencode-ai/sdk": "workspace:*",
|
"@opencode-ai/sdk": "workspace:*",
|
||||||
"zod": "catalog:",
|
"zod": "catalog:",
|
||||||
@@ -382,7 +382,7 @@
|
|||||||
},
|
},
|
||||||
"packages/sdk/js": {
|
"packages/sdk/js": {
|
||||||
"name": "@opencode-ai/sdk",
|
"name": "@opencode-ai/sdk",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@hey-api/openapi-ts": "0.90.10",
|
"@hey-api/openapi-ts": "0.90.10",
|
||||||
"@tsconfig/node22": "catalog:",
|
"@tsconfig/node22": "catalog:",
|
||||||
@@ -393,7 +393,7 @@
|
|||||||
},
|
},
|
||||||
"packages/slack": {
|
"packages/slack": {
|
||||||
"name": "@opencode-ai/slack",
|
"name": "@opencode-ai/slack",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@opencode-ai/sdk": "workspace:*",
|
"@opencode-ai/sdk": "workspace:*",
|
||||||
"@slack/bolt": "^3.17.1",
|
"@slack/bolt": "^3.17.1",
|
||||||
@@ -406,7 +406,7 @@
|
|||||||
},
|
},
|
||||||
"packages/ui": {
|
"packages/ui": {
|
||||||
"name": "@opencode-ai/ui",
|
"name": "@opencode-ai/ui",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@kobalte/core": "catalog:",
|
"@kobalte/core": "catalog:",
|
||||||
"@opencode-ai/sdk": "workspace:*",
|
"@opencode-ai/sdk": "workspace:*",
|
||||||
@@ -448,7 +448,7 @@
|
|||||||
},
|
},
|
||||||
"packages/util": {
|
"packages/util": {
|
||||||
"name": "@opencode-ai/util",
|
"name": "@opencode-ai/util",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"zod": "catalog:",
|
"zod": "catalog:",
|
||||||
},
|
},
|
||||||
@@ -459,7 +459,7 @@
|
|||||||
},
|
},
|
||||||
"packages/web": {
|
"packages/web": {
|
||||||
"name": "@opencode-ai/web",
|
"name": "@opencode-ai/web",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/cloudflare": "12.6.3",
|
"@astrojs/cloudflare": "12.6.3",
|
||||||
"@astrojs/markdown-remark": "6.3.1",
|
"@astrojs/markdown-remark": "6.3.1",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@opencode-ai/app",
|
"name": "@opencode-ai/app",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"description": "",
|
"description": "",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"exports": {
|
"exports": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@opencode-ai/console-app",
|
"name": "@opencode-ai/console-app",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://json.schemastore.org/package.json",
|
"$schema": "https://json.schemastore.org/package.json",
|
||||||
"name": "@opencode-ai/console-core",
|
"name": "@opencode-ai/console-core",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@opencode-ai/console-function",
|
"name": "@opencode-ai/console-function",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"$schema": "https://json.schemastore.org/package.json",
|
"$schema": "https://json.schemastore.org/package.json",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@opencode-ai/console-mail",
|
"name": "@opencode-ai/console-mail",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jsx-email/all": "2.2.3",
|
"@jsx-email/all": "2.2.3",
|
||||||
"@jsx-email/cli": "1.4.3",
|
"@jsx-email/cli": "1.4.3",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@opencode-ai/desktop",
|
"name": "@opencode-ai/desktop",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@opencode-ai/enterprise",
|
"name": "@opencode-ai/enterprise",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
id = "opencode"
|
id = "opencode"
|
||||||
name = "OpenCode"
|
name = "OpenCode"
|
||||||
description = "The open source coding agent."
|
description = "The open source coding agent."
|
||||||
version = "1.1.42"
|
version = "0.0.0-ci-202601291718"
|
||||||
schema_version = 1
|
schema_version = 1
|
||||||
authors = ["Anomaly"]
|
authors = ["Anomaly"]
|
||||||
repository = "https://github.com/anomalyco/opencode"
|
repository = "https://github.com/anomalyco/opencode"
|
||||||
@@ -11,26 +11,26 @@ name = "OpenCode"
|
|||||||
icon = "./icons/opencode.svg"
|
icon = "./icons/opencode.svg"
|
||||||
|
|
||||||
[agent_servers.opencode.targets.darwin-aarch64]
|
[agent_servers.opencode.targets.darwin-aarch64]
|
||||||
archive = "https://github.com/anomalyco/opencode/releases/download/v1.1.42/opencode-darwin-arm64.zip"
|
archive = "https://github.com/anomalyco/opencode/releases/download/v0.0.0-ci-202601291718/opencode-darwin-arm64.zip"
|
||||||
cmd = "./opencode"
|
cmd = "./opencode"
|
||||||
args = ["acp"]
|
args = ["acp"]
|
||||||
|
|
||||||
[agent_servers.opencode.targets.darwin-x86_64]
|
[agent_servers.opencode.targets.darwin-x86_64]
|
||||||
archive = "https://github.com/anomalyco/opencode/releases/download/v1.1.42/opencode-darwin-x64.zip"
|
archive = "https://github.com/anomalyco/opencode/releases/download/v0.0.0-ci-202601291718/opencode-darwin-x64.zip"
|
||||||
cmd = "./opencode"
|
cmd = "./opencode"
|
||||||
args = ["acp"]
|
args = ["acp"]
|
||||||
|
|
||||||
[agent_servers.opencode.targets.linux-aarch64]
|
[agent_servers.opencode.targets.linux-aarch64]
|
||||||
archive = "https://github.com/anomalyco/opencode/releases/download/v1.1.42/opencode-linux-arm64.tar.gz"
|
archive = "https://github.com/anomalyco/opencode/releases/download/v0.0.0-ci-202601291718/opencode-linux-arm64.tar.gz"
|
||||||
cmd = "./opencode"
|
cmd = "./opencode"
|
||||||
args = ["acp"]
|
args = ["acp"]
|
||||||
|
|
||||||
[agent_servers.opencode.targets.linux-x86_64]
|
[agent_servers.opencode.targets.linux-x86_64]
|
||||||
archive = "https://github.com/anomalyco/opencode/releases/download/v1.1.42/opencode-linux-x64.tar.gz"
|
archive = "https://github.com/anomalyco/opencode/releases/download/v0.0.0-ci-202601291718/opencode-linux-x64.tar.gz"
|
||||||
cmd = "./opencode"
|
cmd = "./opencode"
|
||||||
args = ["acp"]
|
args = ["acp"]
|
||||||
|
|
||||||
[agent_servers.opencode.targets.windows-x86_64]
|
[agent_servers.opencode.targets.windows-x86_64]
|
||||||
archive = "https://github.com/anomalyco/opencode/releases/download/v1.1.42/opencode-windows-x64.zip"
|
archive = "https://github.com/anomalyco/opencode/releases/download/v0.0.0-ci-202601291718/opencode-windows-x64.zip"
|
||||||
cmd = "./opencode.exe"
|
cmd = "./opencode.exe"
|
||||||
args = ["acp"]
|
args = ["acp"]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@opencode-ai/function",
|
"name": "@opencode-ai/function",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"$schema": "https://json.schemastore.org/package.json",
|
"$schema": "https://json.schemastore.org/package.json",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://json.schemastore.org/package.json",
|
"$schema": "https://json.schemastore.org/package.json",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"name": "opencode",
|
"name": "opencode",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
@@ -179,4 +179,15 @@ for (const item of targets) {
|
|||||||
binaries[name] = Script.version
|
binaries[name] = Script.version
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Script.release) {
|
||||||
|
for (const key of Object.keys(binaries)) {
|
||||||
|
if (key.includes("linux")) {
|
||||||
|
await $`tar -czf ../../${key}.tar.gz *`.cwd(`dist/${key}/bin`)
|
||||||
|
} else {
|
||||||
|
await $`zip -r ../../${key}.zip *`.cwd(`dist/${key}/bin`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await $`gh release upload v${Script.version} ./dist/*.zip ./dist/*.tar.gz --clobber`
|
||||||
|
}
|
||||||
|
|
||||||
export { binaries }
|
export { binaries }
|
||||||
|
|||||||
@@ -1,187 +0,0 @@
|
|||||||
#!/usr/bin/env bun
|
|
||||||
import { $ } from "bun"
|
|
||||||
import { Script } from "@opencode-ai/script"
|
|
||||||
|
|
||||||
if (!Script.preview) {
|
|
||||||
// Calculate SHA values
|
|
||||||
const arm64Sha = await $`sha256sum ./dist/opencode-linux-arm64.tar.gz | cut -d' ' -f1`.text().then((x) => x.trim())
|
|
||||||
const x64Sha = await $`sha256sum ./dist/opencode-linux-x64.tar.gz | 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())
|
|
||||||
|
|
||||||
const [pkgver, _subver = ""] = Script.version.split(/(-.*)/, 2)
|
|
||||||
|
|
||||||
// arch
|
|
||||||
const binaryPkgbuild = [
|
|
||||||
"# Maintainer: dax",
|
|
||||||
"# Maintainer: adam",
|
|
||||||
"",
|
|
||||||
"pkgname='opencode-bin'",
|
|
||||||
`pkgver=${pkgver}`,
|
|
||||||
`_subver=${_subver}`,
|
|
||||||
"options=('!debug' '!strip')",
|
|
||||||
"pkgrel=1",
|
|
||||||
"pkgdesc='The AI coding agent built for the terminal.'",
|
|
||||||
"url='https://github.com/anomalyco/opencode'",
|
|
||||||
"arch=('aarch64' 'x86_64')",
|
|
||||||
"license=('MIT')",
|
|
||||||
"provides=('opencode')",
|
|
||||||
"conflicts=('opencode')",
|
|
||||||
"depends=('ripgrep')",
|
|
||||||
"",
|
|
||||||
`source_aarch64=("\${pkgname}_\${pkgver}_aarch64.tar.gz::https://github.com/anomalyco/opencode/releases/download/v\${pkgver}\${_subver}/opencode-linux-arm64.tar.gz")`,
|
|
||||||
`sha256sums_aarch64=('${arm64Sha}')`,
|
|
||||||
|
|
||||||
`source_x86_64=("\${pkgname}_\${pkgver}_x86_64.tar.gz::https://github.com/anomalyco/opencode/releases/download/v\${pkgver}\${_subver}/opencode-linux-x64.tar.gz")`,
|
|
||||||
`sha256sums_x86_64=('${x64Sha}')`,
|
|
||||||
"",
|
|
||||||
"package() {",
|
|
||||||
' install -Dm755 ./opencode "${pkgdir}/usr/bin/opencode"',
|
|
||||||
"}",
|
|
||||||
"",
|
|
||||||
].join("\n")
|
|
||||||
|
|
||||||
// Source-based PKGBUILD for opencode
|
|
||||||
const sourcePkgbuild = [
|
|
||||||
"# Maintainer: dax",
|
|
||||||
"# Maintainer: adam",
|
|
||||||
"",
|
|
||||||
"pkgname='opencode'",
|
|
||||||
`pkgver=${pkgver}`,
|
|
||||||
`_subver=${_subver}`,
|
|
||||||
"options=('!debug' '!strip')",
|
|
||||||
"pkgrel=1",
|
|
||||||
"pkgdesc='The AI coding agent built for the terminal.'",
|
|
||||||
"url='https://github.com/anomalyco/opencode'",
|
|
||||||
"arch=('aarch64' 'x86_64')",
|
|
||||||
"license=('MIT')",
|
|
||||||
"provides=('opencode')",
|
|
||||||
"conflicts=('opencode-bin')",
|
|
||||||
"depends=('ripgrep')",
|
|
||||||
"makedepends=('git' 'bun' 'go')",
|
|
||||||
"",
|
|
||||||
`source=("opencode-\${pkgver}.tar.gz::https://github.com/anomalyco/opencode/archive/v\${pkgver}\${_subver}.tar.gz")`,
|
|
||||||
`sha256sums=('SKIP')`,
|
|
||||||
"",
|
|
||||||
"build() {",
|
|
||||||
` cd "opencode-\${pkgver}"`,
|
|
||||||
` bun install`,
|
|
||||||
" cd ./packages/opencode",
|
|
||||||
` OPENCODE_CHANNEL=latest OPENCODE_VERSION=${pkgver} bun run ./script/build.ts --single`,
|
|
||||||
"}",
|
|
||||||
"",
|
|
||||||
"package() {",
|
|
||||||
` cd "opencode-\${pkgver}/packages/opencode"`,
|
|
||||||
' mkdir -p "${pkgdir}/usr/bin"',
|
|
||||||
' target_arch="x64"',
|
|
||||||
' case "$CARCH" in',
|
|
||||||
' x86_64) target_arch="x64" ;;',
|
|
||||||
' aarch64) target_arch="arm64" ;;',
|
|
||||||
' *) printf "unsupported architecture: %s\\n" "$CARCH" >&2 ; return 1 ;;',
|
|
||||||
" esac",
|
|
||||||
' libc=""',
|
|
||||||
" if command -v ldd >/dev/null 2>&1; then",
|
|
||||||
" if ldd --version 2>&1 | grep -qi musl; then",
|
|
||||||
' libc="-musl"',
|
|
||||||
" fi",
|
|
||||||
" fi",
|
|
||||||
' if [ -z "$libc" ] && ls /lib/ld-musl-* >/dev/null 2>&1; then',
|
|
||||||
' libc="-musl"',
|
|
||||||
" fi",
|
|
||||||
' base=""',
|
|
||||||
' if [ "$target_arch" = "x64" ]; then',
|
|
||||||
" if ! grep -qi avx2 /proc/cpuinfo 2>/dev/null; then",
|
|
||||||
' base="-baseline"',
|
|
||||||
" fi",
|
|
||||||
" fi",
|
|
||||||
' bin="dist/opencode-linux-${target_arch}${base}${libc}/bin/opencode"',
|
|
||||||
' if [ ! -f "$bin" ]; then',
|
|
||||||
' printf "unable to find binary for %s%s%s\\n" "$target_arch" "$base" "$libc" >&2',
|
|
||||||
" return 1",
|
|
||||||
" fi",
|
|
||||||
' install -Dm755 "$bin" "${pkgdir}/usr/bin/opencode"',
|
|
||||||
"}",
|
|
||||||
"",
|
|
||||||
].join("\n")
|
|
||||||
|
|
||||||
for (const [pkg, pkgbuild] of [
|
|
||||||
["opencode-bin", binaryPkgbuild],
|
|
||||||
["opencode", sourcePkgbuild],
|
|
||||||
]) {
|
|
||||||
for (let i = 0; i < 30; i++) {
|
|
||||||
try {
|
|
||||||
await $`rm -rf ./dist/aur-${pkg}`
|
|
||||||
await $`git clone ssh://aur@aur.archlinux.org/${pkg}.git ./dist/aur-${pkg}`
|
|
||||||
await $`cd ./dist/aur-${pkg} && git checkout master`
|
|
||||||
await Bun.file(`./dist/aur-${pkg}/PKGBUILD`).write(pkgbuild)
|
|
||||||
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${Script.version}"`
|
|
||||||
await $`cd ./dist/aur-${pkg} && git push`
|
|
||||||
break
|
|
||||||
} catch (e) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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/anomalyco/opencode"`,
|
|
||||||
` version "${Script.version.split("-")[0]}"`,
|
|
||||||
"",
|
|
||||||
` depends_on "ripgrep"`,
|
|
||||||
"",
|
|
||||||
" on_macos do",
|
|
||||||
" if Hardware::CPU.intel?",
|
|
||||||
` url "https://github.com/anomalyco/opencode/releases/download/v${Script.version}/opencode-darwin-x64.zip"`,
|
|
||||||
` sha256 "${macX64Sha}"`,
|
|
||||||
"",
|
|
||||||
" def install",
|
|
||||||
' bin.install "opencode"',
|
|
||||||
" end",
|
|
||||||
" end",
|
|
||||||
" if Hardware::CPU.arm?",
|
|
||||||
` url "https://github.com/anomalyco/opencode/releases/download/v${Script.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/anomalyco/opencode/releases/download/v${Script.version}/opencode-linux-x64.tar.gz"`,
|
|
||||||
` sha256 "${x64Sha}"`,
|
|
||||||
" def install",
|
|
||||||
' bin.install "opencode"',
|
|
||||||
" end",
|
|
||||||
" end",
|
|
||||||
" if Hardware::CPU.arm? and Hardware::CPU.is_64_bit?",
|
|
||||||
` url "https://github.com/anomalyco/opencode/releases/download/v${Script.version}/opencode-linux-arm64.tar.gz"`,
|
|
||||||
` sha256 "${arm64Sha}"`,
|
|
||||||
" def install",
|
|
||||||
' bin.install "opencode"',
|
|
||||||
" end",
|
|
||||||
" end",
|
|
||||||
" end",
|
|
||||||
"end",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
].join("\n")
|
|
||||||
|
|
||||||
await $`rm -rf ./dist/homebrew-tap`
|
|
||||||
await $`git clone https://${process.env["GITHUB_TOKEN"]}@github.com/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${Script.version}"`
|
|
||||||
await $`cd ./dist/homebrew-tap && git push`
|
|
||||||
}
|
|
||||||
@@ -7,12 +7,13 @@ 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 name = `${pkg.name}-${process.platform}-${process.arch}`
|
const pkg = await Bun.file(`./dist/${filepath}`).json()
|
||||||
console.log(`smoke test: running dist/${name}/bin/opencode --version`)
|
binaries[pkg.name] = pkg.version
|
||||||
await $`./dist/${name}/bin/opencode --version`
|
|
||||||
}
|
}
|
||||||
|
console.log("binaries", binaries)
|
||||||
|
const version = Object.values(binaries)[0]
|
||||||
|
|
||||||
await $`mkdir -p ./dist/${pkg.name}`
|
await $`mkdir -p ./dist/${pkg.name}`
|
||||||
await $`cp -r ./bin ./dist/${pkg.name}/bin`
|
await $`cp -r ./bin ./dist/${pkg.name}/bin`
|
||||||
@@ -28,7 +29,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,
|
||||||
@@ -36,35 +37,203 @@ await Bun.file(`./dist/${pkg.name}/package.json`).write(
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
const tags = [Script.channel]
|
|
||||||
|
|
||||||
const tasks = Object.entries(binaries).map(async ([name]) => {
|
const tasks = Object.entries(binaries).map(async ([name]) => {
|
||||||
if (process.platform !== "win32") {
|
if (process.platform !== "win32") {
|
||||||
await $`chmod -R 755 .`.cwd(`./dist/${name}`)
|
await $`chmod -R 755 .`.cwd(`./dist/${name}`)
|
||||||
}
|
}
|
||||||
await $`bun pm pack`.cwd(`./dist/${name}`)
|
await $`bun pm pack`.cwd(`./dist/${name}`)
|
||||||
for (const tag of tags) {
|
await $`npm publish *.tgz --access public --tag ${Script.channel}`.cwd(`./dist/${name}`)
|
||||||
await $`npm publish *.tgz --access public --tag ${tag}`.cwd(`./dist/${name}`)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
await Promise.all(tasks)
|
await Promise.all(tasks)
|
||||||
for (const tag of tags) {
|
await $`cd ./dist/${pkg.name} && bun pm pack && npm publish *.tgz --access public --tag ${Script.channel}`
|
||||||
await $`cd ./dist/${pkg.name} && bun pm pack && npm publish *.tgz --access public --tag ${tag}`
|
|
||||||
}
|
|
||||||
|
|
||||||
|
const image = "ghcr.io/anomalyco/opencode"
|
||||||
|
const platforms = "linux/amd64,linux/arm64"
|
||||||
|
const tags = [`${image}:${version}`, `${image}:${Script.channel}`]
|
||||||
|
const tagFlags = tags.flatMap((t) => ["-t", t])
|
||||||
|
await $`docker buildx build --platform ${platforms} ${tagFlags} --push .`
|
||||||
|
|
||||||
|
// registries
|
||||||
if (!Script.preview) {
|
if (!Script.preview) {
|
||||||
// Create archives for GitHub release
|
// Calculate SHA values
|
||||||
for (const key of Object.keys(binaries)) {
|
const arm64Sha = await $`sha256sum ./dist/opencode-linux-arm64.tar.gz | cut -d' ' -f1`.text().then((x) => x.trim())
|
||||||
if (key.includes("linux")) {
|
const x64Sha = await $`sha256sum ./dist/opencode-linux-x64.tar.gz | cut -d' ' -f1`.text().then((x) => x.trim())
|
||||||
await $`tar -czf ../../${key}.tar.gz *`.cwd(`dist/${key}/bin`)
|
const macX64Sha = await $`sha256sum ./dist/opencode-darwin-x64.zip | cut -d' ' -f1`.text().then((x) => x.trim())
|
||||||
} else {
|
const macArm64Sha = await $`sha256sum ./dist/opencode-darwin-arm64.zip | cut -d' ' -f1`.text().then((x) => x.trim())
|
||||||
await $`zip -r ../../${key}.zip *`.cwd(`dist/${key}/bin`)
|
|
||||||
|
const [pkgver, _subver = ""] = Script.version.split(/(-.*)/, 2)
|
||||||
|
|
||||||
|
// arch
|
||||||
|
const binaryPkgbuild = [
|
||||||
|
"# Maintainer: dax",
|
||||||
|
"# Maintainer: adam",
|
||||||
|
"",
|
||||||
|
"pkgname='opencode-bin'",
|
||||||
|
`pkgver=${pkgver}`,
|
||||||
|
`_subver=${_subver}`,
|
||||||
|
"options=('!debug' '!strip')",
|
||||||
|
"pkgrel=1",
|
||||||
|
"pkgdesc='The AI coding agent built for the terminal.'",
|
||||||
|
"url='https://github.com/anomalyco/opencode'",
|
||||||
|
"arch=('aarch64' 'x86_64')",
|
||||||
|
"license=('MIT')",
|
||||||
|
"provides=('opencode')",
|
||||||
|
"conflicts=('opencode')",
|
||||||
|
"depends=('ripgrep')",
|
||||||
|
"",
|
||||||
|
`source_aarch64=("\${pkgname}_\${pkgver}_aarch64.tar.gz::https://github.com/anomalyco/opencode/releases/download/v\${pkgver}\${_subver}/opencode-linux-arm64.tar.gz")`,
|
||||||
|
`sha256sums_aarch64=('${arm64Sha}')`,
|
||||||
|
|
||||||
|
`source_x86_64=("\${pkgname}_\${pkgver}_x86_64.tar.gz::https://github.com/anomalyco/opencode/releases/download/v\${pkgver}\${_subver}/opencode-linux-x64.tar.gz")`,
|
||||||
|
`sha256sums_x86_64=('${x64Sha}')`,
|
||||||
|
"",
|
||||||
|
"package() {",
|
||||||
|
' install -Dm755 ./opencode "${pkgdir}/usr/bin/opencode"',
|
||||||
|
"}",
|
||||||
|
"",
|
||||||
|
].join("\n")
|
||||||
|
|
||||||
|
// Source-based PKGBUILD for opencode
|
||||||
|
const sourcePkgbuild = [
|
||||||
|
"# Maintainer: dax",
|
||||||
|
"# Maintainer: adam",
|
||||||
|
"",
|
||||||
|
"pkgname='opencode'",
|
||||||
|
`pkgver=${pkgver}`,
|
||||||
|
`_subver=${_subver}`,
|
||||||
|
"options=('!debug' '!strip')",
|
||||||
|
"pkgrel=1",
|
||||||
|
"pkgdesc='The AI coding agent built for the terminal.'",
|
||||||
|
"url='https://github.com/anomalyco/opencode'",
|
||||||
|
"arch=('aarch64' 'x86_64')",
|
||||||
|
"license=('MIT')",
|
||||||
|
"provides=('opencode')",
|
||||||
|
"conflicts=('opencode-bin')",
|
||||||
|
"depends=('ripgrep')",
|
||||||
|
"makedepends=('git' 'bun' 'go')",
|
||||||
|
"",
|
||||||
|
`source=("opencode-\${pkgver}.tar.gz::https://github.com/anomalyco/opencode/archive/v\${pkgver}\${_subver}.tar.gz")`,
|
||||||
|
`sha256sums=('SKIP')`,
|
||||||
|
"",
|
||||||
|
"build() {",
|
||||||
|
` cd "opencode-\${pkgver}"`,
|
||||||
|
` bun install`,
|
||||||
|
" cd ./packages/opencode",
|
||||||
|
` OPENCODE_CHANNEL=latest OPENCODE_VERSION=${pkgver} bun run ./script/build.ts --single`,
|
||||||
|
"}",
|
||||||
|
"",
|
||||||
|
"package() {",
|
||||||
|
` cd "opencode-\${pkgver}/packages/opencode"`,
|
||||||
|
' mkdir -p "${pkgdir}/usr/bin"',
|
||||||
|
' target_arch="x64"',
|
||||||
|
' case "$CARCH" in',
|
||||||
|
' x86_64) target_arch="x64" ;;',
|
||||||
|
' aarch64) target_arch="arm64" ;;',
|
||||||
|
' *) printf "unsupported architecture: %s\\n" "$CARCH" >&2 ; return 1 ;;',
|
||||||
|
" esac",
|
||||||
|
' libc=""',
|
||||||
|
" if command -v ldd >/dev/null 2>&1; then",
|
||||||
|
" if ldd --version 2>&1 | grep -qi musl; then",
|
||||||
|
' libc="-musl"',
|
||||||
|
" fi",
|
||||||
|
" fi",
|
||||||
|
' if [ -z "$libc" ] && ls /lib/ld-musl-* >/dev/null 2>&1; then',
|
||||||
|
' libc="-musl"',
|
||||||
|
" fi",
|
||||||
|
' base=""',
|
||||||
|
' if [ "$target_arch" = "x64" ]; then',
|
||||||
|
" if ! grep -qi avx2 /proc/cpuinfo 2>/dev/null; then",
|
||||||
|
' base="-baseline"',
|
||||||
|
" fi",
|
||||||
|
" fi",
|
||||||
|
' bin="dist/opencode-linux-${target_arch}${base}${libc}/bin/opencode"',
|
||||||
|
' if [ ! -f "$bin" ]; then',
|
||||||
|
' printf "unable to find binary for %s%s%s\\n" "$target_arch" "$base" "$libc" >&2',
|
||||||
|
" return 1",
|
||||||
|
" fi",
|
||||||
|
' install -Dm755 "$bin" "${pkgdir}/usr/bin/opencode"',
|
||||||
|
"}",
|
||||||
|
"",
|
||||||
|
].join("\n")
|
||||||
|
|
||||||
|
for (const [pkg, pkgbuild] of [
|
||||||
|
["opencode-bin", binaryPkgbuild],
|
||||||
|
["opencode", sourcePkgbuild],
|
||||||
|
]) {
|
||||||
|
for (let i = 0; i < 30; i++) {
|
||||||
|
try {
|
||||||
|
await $`rm -rf ./dist/aur-${pkg}`
|
||||||
|
await $`git clone ssh://aur@aur.archlinux.org/${pkg}.git ./dist/aur-${pkg}`
|
||||||
|
await $`cd ./dist/aur-${pkg} && git checkout master`
|
||||||
|
await Bun.file(`./dist/aur-${pkg}/PKGBUILD`).write(pkgbuild)
|
||||||
|
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${Script.version}"`
|
||||||
|
await $`cd ./dist/aur-${pkg} && git push`
|
||||||
|
break
|
||||||
|
} catch (e) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const image = "ghcr.io/anomalyco/opencode"
|
// Homebrew formula
|
||||||
const platforms = "linux/amd64,linux/arm64"
|
const homebrewFormula = [
|
||||||
const tags = [`${image}:${Script.version}`, `${image}:latest`]
|
"# typed: false",
|
||||||
const tagFlags = tags.flatMap((t) => ["-t", t])
|
"# frozen_string_literal: true",
|
||||||
await $`docker buildx build --platform ${platforms} ${tagFlags} --push .`
|
"",
|
||||||
|
"# 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/anomalyco/opencode"`,
|
||||||
|
` version "${Script.version.split("-")[0]}"`,
|
||||||
|
"",
|
||||||
|
` depends_on "ripgrep"`,
|
||||||
|
"",
|
||||||
|
" on_macos do",
|
||||||
|
" if Hardware::CPU.intel?",
|
||||||
|
` url "https://github.com/anomalyco/opencode/releases/download/v${Script.version}/opencode-darwin-x64.zip"`,
|
||||||
|
` sha256 "${macX64Sha}"`,
|
||||||
|
"",
|
||||||
|
" def install",
|
||||||
|
' bin.install "opencode"',
|
||||||
|
" end",
|
||||||
|
" end",
|
||||||
|
" if Hardware::CPU.arm?",
|
||||||
|
` url "https://github.com/anomalyco/opencode/releases/download/v${Script.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/anomalyco/opencode/releases/download/v${Script.version}/opencode-linux-x64.tar.gz"`,
|
||||||
|
` sha256 "${x64Sha}"`,
|
||||||
|
" def install",
|
||||||
|
' bin.install "opencode"',
|
||||||
|
" end",
|
||||||
|
" end",
|
||||||
|
" if Hardware::CPU.arm? and Hardware::CPU.is_64_bit?",
|
||||||
|
` url "https://github.com/anomalyco/opencode/releases/download/v${Script.version}/opencode-linux-arm64.tar.gz"`,
|
||||||
|
` sha256 "${arm64Sha}"`,
|
||||||
|
" def install",
|
||||||
|
' bin.install "opencode"',
|
||||||
|
" end",
|
||||||
|
" end",
|
||||||
|
" end",
|
||||||
|
"end",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
].join("\n")
|
||||||
|
|
||||||
|
await $`rm -rf ./dist/homebrew-tap`
|
||||||
|
await $`git clone https://${process.env["GITHUB_TOKEN"]}@github.com/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${Script.version}"`
|
||||||
|
await $`cd ./dist/homebrew-tap && git push`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://json.schemastore.org/package.json",
|
"$schema": "https://json.schemastore.org/package.json",
|
||||||
"name": "@opencode-ai/plugin",
|
"name": "@opencode-ai/plugin",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ const env = {
|
|||||||
OPENCODE_CHANNEL: process.env["OPENCODE_CHANNEL"],
|
OPENCODE_CHANNEL: process.env["OPENCODE_CHANNEL"],
|
||||||
OPENCODE_BUMP: process.env["OPENCODE_BUMP"],
|
OPENCODE_BUMP: process.env["OPENCODE_BUMP"],
|
||||||
OPENCODE_VERSION: process.env["OPENCODE_VERSION"],
|
OPENCODE_VERSION: process.env["OPENCODE_VERSION"],
|
||||||
|
OPENCODE_RELEASE: process.env["OPENCODE_RELEASE"],
|
||||||
}
|
}
|
||||||
const CHANNEL = await (async () => {
|
const CHANNEL = await (async () => {
|
||||||
if (env.OPENCODE_CHANNEL) return env.OPENCODE_CHANNEL
|
if (env.OPENCODE_CHANNEL) return env.OPENCODE_CHANNEL
|
||||||
@@ -55,5 +56,8 @@ export const Script = {
|
|||||||
get preview() {
|
get preview() {
|
||||||
return IS_PREVIEW
|
return IS_PREVIEW
|
||||||
},
|
},
|
||||||
|
get release() {
|
||||||
|
return env.OPENCODE_RELEASE
|
||||||
|
},
|
||||||
}
|
}
|
||||||
console.log(`opencode script`, JSON.stringify(Script, null, 2))
|
console.log(`opencode script`, JSON.stringify(Script, null, 2))
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://json.schemastore.org/package.json",
|
"$schema": "https://json.schemastore.org/package.json",
|
||||||
"name": "@opencode-ai/sdk",
|
"name": "@opencode-ai/sdk",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -6,13 +6,10 @@ import { $ } from "bun"
|
|||||||
const dir = new URL("..", import.meta.url).pathname
|
const dir = new URL("..", import.meta.url).pathname
|
||||||
process.chdir(dir)
|
process.chdir(dir)
|
||||||
|
|
||||||
await import("./build")
|
|
||||||
|
|
||||||
const pkg = await import("../package.json").then((m) => m.default)
|
const pkg = await import("../package.json").then((m) => m.default)
|
||||||
const original = JSON.parse(JSON.stringify(pkg))
|
const original = JSON.parse(JSON.stringify(pkg))
|
||||||
for (const [key, value] of Object.entries(pkg.exports)) {
|
for (const [key, value] of Object.entries(pkg.exports)) {
|
||||||
const file = value.replace("./src/", "./dist/").replace(".ts", "")
|
const file = value.replace("./src/", "./dist/").replace(".ts", "")
|
||||||
/// @ts-expect-error
|
|
||||||
pkg.exports[key] = {
|
pkg.exports[key] = {
|
||||||
import: file + ".js",
|
import: file + ".js",
|
||||||
types: file + ".d.ts",
|
types: file + ".d.ts",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@opencode-ai/slack",
|
"name": "@opencode-ai/slack",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@opencode-ai/ui",
|
"name": "@opencode-ai/ui",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"exports": {
|
"exports": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@opencode-ai/util",
|
"name": "@opencode-ai/util",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "@opencode-ai/web",
|
"name": "@opencode-ai/web",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "astro dev",
|
"dev": "astro dev",
|
||||||
"dev:remote": "VITE_API_URL=https://api.opencode.ai astro dev",
|
"dev:remote": "VITE_API_URL=https://api.opencode.ai astro dev",
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
#!/usr/bin/env bun
|
|
||||||
|
|
||||||
import { Script } from "@opencode-ai/script"
|
|
||||||
import { $ } from "bun"
|
|
||||||
|
|
||||||
if (!Script.preview) {
|
|
||||||
await $`gh release edit v${Script.version} --draft=false`
|
|
||||||
}
|
|
||||||
|
|
||||||
await $`bun install`
|
|
||||||
|
|
||||||
await $`gh release download --pattern "opencode-linux-*64.tar.gz" --pattern "opencode-darwin-*64.zip" -D dist`
|
|
||||||
|
|
||||||
await import(`../packages/opencode/script/publish-registries.ts`)
|
|
||||||
@@ -32,16 +32,8 @@ Add highlights before publishing. Delete this section if no highlights.
|
|||||||
|
|
||||||
`
|
`
|
||||||
|
|
||||||
let notes: string[] = []
|
|
||||||
|
|
||||||
console.log("=== publishing ===\n")
|
console.log("=== publishing ===\n")
|
||||||
|
|
||||||
if (!Script.preview) {
|
|
||||||
const previous = await getLatestRelease()
|
|
||||||
notes = await buildNotes(previous, "HEAD")
|
|
||||||
// notes.unshift(highlightsTemplate)
|
|
||||||
}
|
|
||||||
|
|
||||||
const pkgjsons = await Array.fromAsync(
|
const pkgjsons = await Array.fromAsync(
|
||||||
new Bun.Glob("**/package.json").scan({
|
new Bun.Glob("**/package.json").scan({
|
||||||
absolute: true,
|
absolute: true,
|
||||||
@@ -63,8 +55,22 @@ console.log("updated:", extensionToml)
|
|||||||
await Bun.file(extensionToml).write(toml)
|
await Bun.file(extensionToml).write(toml)
|
||||||
|
|
||||||
await $`bun install`
|
await $`bun install`
|
||||||
|
await import(`../packages/sdk/js/script/build.ts`)
|
||||||
|
|
||||||
console.log("\n=== opencode ===\n")
|
if (Script.release) {
|
||||||
|
const previous = await getLatestRelease()
|
||||||
|
const notes = await buildNotes(previous, "HEAD")
|
||||||
|
// notes.unshift(highlightsTemplate)
|
||||||
|
await $`git commit -am "release: v${Script.version}"`
|
||||||
|
await $`git tag v${Script.version}`
|
||||||
|
await $`git fetch origin`
|
||||||
|
await $`git cherry-pick HEAD..origin/dev`.nothrow()
|
||||||
|
await $`git push origin HEAD --tags --no-verify --force-with-lease`
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 5_000))
|
||||||
|
await $`gh release edit v${Script.version} --draft=false --title "v${Script.version}" --notes ${notes.join("\n") || "No notable changes"}`
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("\n=== cli ===\n")
|
||||||
await import(`../packages/opencode/script/publish.ts`)
|
await import(`../packages/opencode/script/publish.ts`)
|
||||||
|
|
||||||
console.log("\n=== sdk ===\n")
|
console.log("\n=== sdk ===\n")
|
||||||
@@ -75,22 +81,3 @@ await import(`../packages/plugin/script/publish.ts`)
|
|||||||
|
|
||||||
const dir = new URL("..", import.meta.url).pathname
|
const dir = new URL("..", import.meta.url).pathname
|
||||||
process.chdir(dir)
|
process.chdir(dir)
|
||||||
|
|
||||||
let output = `version=${Script.version}\n`
|
|
||||||
|
|
||||||
if (!Script.preview) {
|
|
||||||
await $`git commit -am "release: v${Script.version}"`
|
|
||||||
await $`git tag v${Script.version}`
|
|
||||||
await $`git fetch origin`
|
|
||||||
await $`git cherry-pick HEAD..origin/dev`.nothrow()
|
|
||||||
await $`git push origin HEAD --tags --no-verify --force-with-lease`
|
|
||||||
await new Promise((resolve) => setTimeout(resolve, 5_000))
|
|
||||||
await $`gh release create v${Script.version} -d --title "v${Script.version}" --notes ${notes.join("\n") || "No notable changes"} ./packages/opencode/dist/*.zip ./packages/opencode/dist/*.tar.gz`
|
|
||||||
const release = await $`gh release view v${Script.version} --json id,tagName`.json()
|
|
||||||
output += `release=${release.id}\n`
|
|
||||||
output += `tag=${release.tagName}\n`
|
|
||||||
}
|
|
||||||
|
|
||||||
if (process.env.GITHUB_OUTPUT) {
|
|
||||||
await Bun.write(process.env.GITHUB_OUTPUT, output)
|
|
||||||
}
|
|
||||||
17
script/version.ts
Executable file
17
script/version.ts
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/env bun
|
||||||
|
|
||||||
|
import { Script } from "@opencode-ai/script"
|
||||||
|
import { $ } from "bun"
|
||||||
|
|
||||||
|
let output = [`version=${Script.version}`]
|
||||||
|
|
||||||
|
if (!Script.preview) {
|
||||||
|
await $`gh release create v${Script.version} -d --title "v${Script.version}" ${Script.preview ? "--prerelease" : ""}`
|
||||||
|
const release = await $`gh release view v${Script.version} --json id,tagName`.json()
|
||||||
|
output.push(`release=${release.id}`)
|
||||||
|
output.push(`tag=${release.tagName}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.env.GITHUB_OUTPUT) {
|
||||||
|
await Bun.write(process.env.GITHUB_OUTPUT, output.join("\n"))
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "opencode",
|
"name": "opencode",
|
||||||
"displayName": "opencode",
|
"displayName": "opencode",
|
||||||
"description": "opencode for VS Code",
|
"description": "opencode for VS Code",
|
||||||
"version": "1.1.42",
|
"version": "0.0.0-ci-202601291718",
|
||||||
"publisher": "sst-dev",
|
"publisher": "sst-dev",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
Reference in New Issue
Block a user