Skip to content

Commit 5ef0ad3

Browse files
author
anduimagui
committed
Merge remote-tracking branch 'upstream/dev' into sync/fork-dev
2 parents a51a048 + 7ec398d commit 5ef0ad3

1,221 files changed

Lines changed: 67748 additions & 21417 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/setup-bun/action.yml

Lines changed: 4 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
name: "Setup Bun"
22
description: "Setup Bun with caching and install dependencies"
3-
inputs:
4-
cross-compile:
5-
description: "Pre-cache canary cross-compile binaries for all targets"
6-
required: false
7-
default: "false"
83
runs:
94
using: "composite"
105
steps:
@@ -21,12 +16,13 @@ runs:
2116
shell: bash
2217
run: |
2318
if [ "$RUNNER_ARCH" = "X64" ]; then
19+
V=$(node -p "require('./package.json').packageManager.split('@')[1]")
2420
case "$RUNNER_OS" in
2521
macOS) OS=darwin ;;
2622
Linux) OS=linux ;;
2723
Windows) OS=windows ;;
2824
esac
29-
echo "url=https://github.com/oven-sh/bun/releases/download/canary/bun-${OS}-x64-baseline.zip" >> "$GITHUB_OUTPUT"
25+
echo "url=https://github.com/oven-sh/bun/releases/download/bun-v${V}/bun-${OS}-x64-baseline.zip" >> "$GITHUB_OUTPUT"
3026
fi
3127
3228
- name: Setup Bun
@@ -35,53 +31,9 @@ runs:
3531
bun-version-file: ${{ !steps.bun-url.outputs.url && 'package.json' || '' }}
3632
bun-download-url: ${{ steps.bun-url.outputs.url }}
3733

38-
- name: Pre-cache canary cross-compile binaries
39-
if: inputs.cross-compile == 'true'
34+
- name: Install setuptools for distutils compatibility
35+
run: python3 -m pip install setuptools || pip install setuptools || true
4036
shell: bash
41-
run: |
42-
BUN_VERSION=$(bun --revision)
43-
if echo "$BUN_VERSION" | grep -q "canary"; then
44-
SEMVER=$(echo "$BUN_VERSION" | sed 's/^\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/')
45-
echo "Bun version: $BUN_VERSION (semver: $SEMVER)"
46-
CACHE_DIR="$HOME/.bun/install/cache"
47-
mkdir -p "$CACHE_DIR"
48-
TMP_DIR=$(mktemp -d)
49-
for TARGET in linux-aarch64 linux-x64 linux-x64-baseline linux-aarch64-musl linux-x64-musl linux-x64-musl-baseline darwin-aarch64 darwin-x64 windows-x64 windows-x64-baseline; do
50-
DEST="$CACHE_DIR/bun-${TARGET}-v${SEMVER}"
51-
if [ -f "$DEST" ]; then
52-
echo "Already cached: $DEST"
53-
continue
54-
fi
55-
URL="https://github.com/oven-sh/bun/releases/download/canary/bun-${TARGET}.zip"
56-
echo "Downloading $TARGET from $URL"
57-
if curl -sfL -o "$TMP_DIR/bun.zip" "$URL"; then
58-
unzip -qo "$TMP_DIR/bun.zip" -d "$TMP_DIR"
59-
if echo "$TARGET" | grep -q "windows"; then
60-
BIN_NAME="bun.exe"
61-
else
62-
BIN_NAME="bun"
63-
fi
64-
mv "$TMP_DIR/bun-${TARGET}/$BIN_NAME" "$DEST"
65-
chmod +x "$DEST"
66-
rm -rf "$TMP_DIR/bun-${TARGET}" "$TMP_DIR/bun.zip"
67-
echo "Cached: $DEST"
68-
# baseline bun resolves "bun-darwin-x64" to the baseline cache key
69-
# so copy the modern binary there too
70-
if [ "$TARGET" = "darwin-x64" ]; then
71-
BASELINE_DEST="$CACHE_DIR/bun-darwin-x64-baseline-v${SEMVER}"
72-
if [ ! -f "$BASELINE_DEST" ]; then
73-
cp "$DEST" "$BASELINE_DEST"
74-
echo "Cached (baseline alias): $BASELINE_DEST"
75-
fi
76-
fi
77-
else
78-
echo "Skipped: $TARGET (not available)"
79-
fi
80-
done
81-
rm -rf "$TMP_DIR"
82-
else
83-
echo "Not a canary build ($BUN_VERSION), skipping pre-cache"
84-
fi
8537

8638
- name: Install dependencies
8739
run: bun install

.github/workflows/beta.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ jobs:
2727
opencode-app-id: ${{ vars.OPENCODE_APP_ID }}
2828
opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }}
2929

30+
- name: Install OpenCode
31+
run: bun i -g opencode-ai
32+
3033
- name: Sync beta branch
3134
env:
3235
GH_TOKEN: ${{ steps.setup-git-committer.outputs.token }}
36+
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
3337
run: bun script/beta.ts

.github/workflows/docs-locale-sync.yml

Lines changed: 11 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -47,60 +47,26 @@ jobs:
4747
echo "EOF"
4848
} >> "$GITHUB_OUTPUT"
4949
50+
- name: Install OpenCode
51+
if: steps.changes.outputs.has_changes == 'true'
52+
run: curl -fsSL https://opencode.ai/install | bash
53+
5054
- name: Sync locale docs with OpenCode
5155
if: steps.changes.outputs.has_changes == 'true'
52-
uses: sst/opencode/github@latest
5356
env:
5457
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
55-
GITHUB_TOKEN: ${{ steps.committer.outputs.token }}
5658
OPENCODE_CONFIG_CONTENT: |
5759
{
5860
"permission": {
5961
"*": "deny",
60-
"read": {
61-
"*": "deny",
62-
"packages/web/src/content/docs": "allow",
63-
"packages/web/src/content/docs/*": "allow",
64-
"packages/web/src/content/docs/*.mdx": "allow",
65-
"packages/web/src/content/docs/*/*.mdx": "allow",
66-
".opencode": "allow",
67-
".opencode/agent": "allow",
68-
".opencode/agent/glossary": "allow",
69-
".opencode/agent/translator.md": "allow",
70-
".opencode/agent/glossary/*.md": "allow"
71-
},
72-
"edit": {
73-
"*": "deny",
74-
"packages/web/src/content/docs/*/*.mdx": "allow"
75-
},
76-
"glob": {
77-
"*": "deny",
78-
"packages/web/src/content/docs*": "allow",
79-
".opencode/agent/glossary*": "allow"
80-
},
81-
"task": {
82-
"*": "deny",
83-
"translator": "allow"
84-
}
85-
},
86-
"agent": {
87-
"translator": {
88-
"permission": {
89-
"*": "deny",
90-
"read": {
91-
"*": "deny",
92-
".opencode/agent/translator.md": "allow",
93-
".opencode/agent/glossary/*.md": "allow"
94-
}
95-
}
96-
}
62+
"read": "allow",
63+
"edit": "allow",
64+
"glob": "allow",
65+
"task": "allow"
9766
}
9867
}
99-
with:
100-
model: opencode/gpt-5.3-codex
101-
agent: docs
102-
use_github_token: true
103-
prompt: |
68+
run: |
69+
opencode run --agent docs --model opencode/gpt-5.3-codex <<'EOF'
10470
Update localized docs to match the latest English docs changes.
10571
10672
Changed English doc files:
@@ -118,6 +84,7 @@ jobs:
11884
7. Keep locale docs structure aligned with their corresponding English pages.
11985
8. Do not modify English source docs in packages/web/src/content/docs/*.mdx.
12086
9. If no locale updates are needed, make no changes.
87+
EOF
12188
12289
- name: Commit and push locale docs updates
12390
if: steps.changes.outputs.has_changes == 'true'

.github/workflows/publish.yml

Lines changed: 128 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ jobs:
7777
fetch-tags: true
7878

7979
- uses: ./.github/actions/setup-bun
80-
with:
81-
cross-compile: "true"
8280

8381
- name: Setup git committer
8482
id: committer
@@ -90,7 +88,7 @@ jobs:
9088
- name: Build
9189
id: build
9290
run: |
93-
./packages/opencode/script/build.ts --all
91+
./packages/opencode/script/build.ts
9492
env:
9593
OPENCODE_VERSION: ${{ needs.version.outputs.version }}
9694
OPENCODE_RELEASE: ${{ needs.version.outputs.release }}
@@ -101,7 +99,6 @@ jobs:
10199
with:
102100
name: opencode-cli
103101
path: packages/opencode/dist
104-
105102
outputs:
106103
version: ${{ needs.version.outputs.version }}
107104

@@ -242,11 +239,131 @@ jobs:
242239
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
243240
APPLE_API_KEY_PATH: ${{ runner.temp }}/apple-api-key.p8
244241

242+
build-electron:
243+
needs:
244+
- build-cli
245+
- version
246+
continue-on-error: false
247+
strategy:
248+
fail-fast: false
249+
matrix:
250+
settings:
251+
- host: macos-latest
252+
target: x86_64-apple-darwin
253+
platform_flag: --mac --x64
254+
- host: macos-latest
255+
target: aarch64-apple-darwin
256+
platform_flag: --mac --arm64
257+
- host: "blacksmith-4vcpu-windows-2025"
258+
target: x86_64-pc-windows-msvc
259+
platform_flag: --win
260+
- host: "blacksmith-4vcpu-ubuntu-2404"
261+
target: x86_64-unknown-linux-gnu
262+
platform_flag: --linux
263+
- host: "blacksmith-4vcpu-ubuntu-2404"
264+
target: aarch64-unknown-linux-gnu
265+
platform_flag: --linux
266+
runs-on: ${{ matrix.settings.host }}
267+
# if: github.ref_name == 'beta'
268+
steps:
269+
- uses: actions/checkout@v3
270+
271+
- uses: apple-actions/import-codesign-certs@v2
272+
if: runner.os == 'macOS'
273+
with:
274+
keychain: build
275+
p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }}
276+
p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
277+
278+
- name: Setup Apple API Key
279+
if: runner.os == 'macOS'
280+
run: echo "${{ secrets.APPLE_API_KEY_PATH }}" > $RUNNER_TEMP/apple-api-key.p8
281+
282+
- uses: ./.github/actions/setup-bun
283+
284+
- uses: actions/setup-node@v4
285+
with:
286+
node-version: "24"
287+
288+
- name: Cache apt packages
289+
if: contains(matrix.settings.host, 'ubuntu')
290+
uses: actions/cache@v4
291+
with:
292+
path: ~/apt-cache
293+
key: ${{ runner.os }}-${{ matrix.settings.target }}-apt-electron-${{ hashFiles('.github/workflows/publish.yml') }}
294+
restore-keys: |
295+
${{ runner.os }}-${{ matrix.settings.target }}-apt-electron-
296+
297+
- name: Install dependencies (ubuntu only)
298+
if: contains(matrix.settings.host, 'ubuntu')
299+
run: |
300+
mkdir -p ~/apt-cache && chmod -R a+rw ~/apt-cache
301+
sudo apt-get update
302+
sudo apt-get install -y --no-install-recommends -o dir::cache::archives="$HOME/apt-cache" rpm
303+
sudo chmod -R a+rw ~/apt-cache
304+
305+
- name: Setup git committer
306+
id: committer
307+
uses: ./.github/actions/setup-git-committer
308+
with:
309+
opencode-app-id: ${{ vars.OPENCODE_APP_ID }}
310+
opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }}
311+
312+
- name: Prepare
313+
run: bun ./scripts/prepare.ts
314+
working-directory: packages/desktop-electron
315+
env:
316+
OPENCODE_VERSION: ${{ needs.version.outputs.version }}
317+
OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }}
318+
RUST_TARGET: ${{ matrix.settings.target }}
319+
GH_TOKEN: ${{ github.token }}
320+
GITHUB_RUN_ID: ${{ github.run_id }}
321+
322+
- name: Build
323+
run: bun run build
324+
working-directory: packages/desktop-electron
325+
env:
326+
OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }}
327+
328+
- name: Package and publish
329+
if: needs.version.outputs.release
330+
run: npx electron-builder ${{ matrix.settings.platform_flag }} --publish always --config electron-builder.config.ts
331+
working-directory: packages/desktop-electron
332+
timeout-minutes: 60
333+
env:
334+
OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }}
335+
GH_TOKEN: ${{ steps.committer.outputs.token }}
336+
CSC_LINK: ${{ secrets.APPLE_CERTIFICATE }}
337+
CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
338+
APPLE_API_KEY: ${{ runner.temp }}/apple-api-key.p8
339+
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY }}
340+
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
341+
342+
- name: Package (no publish)
343+
if: ${{ !needs.version.outputs.release }}
344+
run: npx electron-builder ${{ matrix.settings.platform_flag }} --publish never --config electron-builder.config.ts
345+
working-directory: packages/desktop-electron
346+
timeout-minutes: 60
347+
env:
348+
OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }}
349+
350+
- uses: actions/upload-artifact@v4
351+
with:
352+
name: opencode-electron-${{ matrix.settings.target }}
353+
path: packages/desktop-electron/dist/*
354+
355+
- uses: actions/upload-artifact@v4
356+
if: needs.version.outputs.release
357+
with:
358+
name: latest-yml-${{ matrix.settings.target }}
359+
path: packages/desktop-electron/dist/latest*.yml
360+
245361
publish:
246362
needs:
247363
- version
248364
- build-cli
249365
- build-tauri
366+
- build-electron
250367
runs-on: blacksmith-4vcpu-ubuntu-2404
251368
steps:
252369
- uses: actions/checkout@v3
@@ -283,6 +400,12 @@ jobs:
283400
name: opencode-cli
284401
path: packages/opencode/dist
285402

403+
- uses: actions/download-artifact@v4
404+
if: needs.version.outputs.release
405+
with:
406+
pattern: latest-yml-*
407+
path: /tmp/latest-yml
408+
286409
- name: Cache apt packages (AUR)
287410
uses: actions/cache@v4
288411
with:
@@ -310,3 +433,4 @@ jobs:
310433
GITHUB_TOKEN: ${{ steps.committer.outputs.token }}
311434
GH_REPO: ${{ needs.version.outputs.repo }}
312435
NPM_CONFIG_PROVENANCE: false
436+
LATEST_YML_DIR: /tmp/latest-yml

.github/workflows/sign-cli.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@ jobs:
2020
fetch-tags: true
2121

2222
- uses: ./.github/actions/setup-bun
23-
with:
24-
cross-compile: "true"
2523

2624
- name: Build
2725
run: |
28-
./packages/opencode/script/build.ts --all
26+
./packages/opencode/script/build.ts
2927
3028
- name: Upload unsigned Windows CLI
3129
id: upload_unsigned_windows_cli

0 commit comments

Comments
 (0)