Skip to content

Commit 6b368cd

Browse files
gaoyu06claude
andcommitted
ci: cross-platform release workflow (macOS/Linux/Windows) on tag
- add .github/workflows/release.yml: on a version tag, build the Tauri app on macOS (arm64 + intel), Linux and Windows via tauri-action, bundling the engine sidecar, and publish a GitHub prerelease with the installers - port the engine-staging script to cross-platform Node (scripts/ prepare-engine.mjs) so it runs in beforeBuildCommand on Windows too; remove the bash-only prepare-engine.sh Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent d9cd0cf commit 6b368cd

4 files changed

Lines changed: 117 additions & 20 deletions

File tree

.github/workflows/release.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Release
2+
3+
# Build and publish a GitHub Release with installers for macOS, Linux and
4+
# Windows whenever a version tag (e.g. v0.1.0a) is pushed.
5+
on:
6+
push:
7+
tags:
8+
- 'v*'
9+
- '[0-9]*'
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
release:
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
- os: macos-latest # Apple Silicon (arm64)
21+
- os: macos-13 # Intel (x86_64)
22+
- os: ubuntu-22.04 # Linux x86_64
23+
- os: windows-latest # Windows x86_64
24+
runs-on: ${{ matrix.os }}
25+
env:
26+
# The engine sidecar is built from the JuCode-CLI checkout below.
27+
JUCODE_CLI_DIR: ${{ github.workspace }}/_engine
28+
steps:
29+
- uses: actions/checkout@v4
30+
- name: Checkout engine (JuCode-CLI)
31+
uses: actions/checkout@v4
32+
with:
33+
repository: JuCode-Team/JuCode-CLI
34+
path: _engine
35+
36+
- name: Install Linux dependencies
37+
if: matrix.os == 'ubuntu-22.04'
38+
run: |
39+
sudo apt-get update
40+
sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev \
41+
libayatana-appindicator3-dev librsvg2-dev libxdo-dev \
42+
build-essential file libssl-dev
43+
44+
- uses: pnpm/action-setup@v4
45+
- uses: actions/setup-node@v4
46+
with:
47+
node-version: 22
48+
cache: pnpm
49+
- uses: dtolnay/rust-toolchain@stable
50+
- uses: Swatinem/rust-cache@v2
51+
with:
52+
workspaces: |
53+
src-tauri
54+
_engine
55+
56+
- run: pnpm install --frozen-lockfile
57+
58+
# tauri-action runs beforeBuildCommand (pnpm bundle:engine && pnpm build),
59+
# which builds the engine sidecar from JUCODE_CLI_DIR, then bundles the app
60+
# and uploads the installers to a release named after the tag.
61+
- uses: tauri-apps/tauri-action@v0
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
with:
65+
tagName: ${{ github.ref_name }}
66+
releaseName: ${{ github.ref_name }}
67+
releaseDraft: false
68+
prerelease: true
69+
releaseBody: |
70+
Automated build. macOS builds are unsigned — on first launch use
71+
right-click → Open, or run `xattr -cr /Applications/JuCode.app`.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"preview": "vite preview",
1111
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
1212
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
13-
"bundle:engine": "./scripts/prepare-engine.sh",
13+
"bundle:engine": "node scripts/prepare-engine.mjs",
1414
"tauri": "tauri",
1515
"test": "vitest run",
1616
"test:watch": "vitest"

scripts/prepare-engine.mjs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Build the jucode engine (release) from the JuCode-CLI checkout and stage it as
2+
// a Tauri sidecar named with the host target triple, so `tauri build` can bundle
3+
// it next to the app binary. Cross-platform (macOS / Linux / Windows) so it works
4+
// both locally and in CI; the bash original only handled Unix.
5+
//
6+
// JuCode-CLI is resolved from JUCODE_CLI_DIR, else a sibling `../JuCode-CLI`.
7+
import { execFileSync } from 'node:child_process';
8+
import { existsSync, mkdirSync, copyFileSync } from 'node:fs';
9+
import { dirname, join, resolve } from 'node:path';
10+
import { fileURLToPath } from 'node:url';
11+
12+
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
13+
const cli = process.env.JUCODE_CLI_DIR
14+
? resolve(process.env.JUCODE_CLI_DIR)
15+
: join(root, '..', 'JuCode-CLI');
16+
17+
if (!existsSync(join(cli, 'Cargo.toml'))) {
18+
console.error(`JuCode-CLI checkout not found at ${cli} (set JUCODE_CLI_DIR to override)`);
19+
process.exit(1);
20+
}
21+
22+
// Host target triple, e.g. aarch64-apple-darwin / x86_64-pc-windows-msvc.
23+
const triple = execFileSync('rustc', ['-vV'], { encoding: 'utf8' })
24+
.split('\n')
25+
.find((l) => l.startsWith('host:'))
26+
?.slice('host:'.length)
27+
.trim();
28+
if (!triple) {
29+
console.error('could not determine host target triple from `rustc -vV`');
30+
process.exit(1);
31+
}
32+
33+
execFileSync(
34+
'cargo',
35+
['build', '--release', '--manifest-path', join(cli, 'Cargo.toml'), '--bin', 'jucode'],
36+
{ stdio: 'inherit' }
37+
);
38+
39+
const ext = process.platform === 'win32' ? '.exe' : '';
40+
const src = join(cli, 'target', 'release', `jucode${ext}`);
41+
const outDir = join(root, 'src-tauri', 'binaries');
42+
mkdirSync(outDir, { recursive: true });
43+
const dest = join(outDir, `jucode-${triple}${ext}`);
44+
copyFileSync(src, dest);
45+
console.log(`staged engine sidecar: ${dest}`);

scripts/prepare-engine.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)