Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 102 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -503,13 +503,110 @@ jobs:
path: apps/omninova-ios/release-assets/**
if-no-files-found: error

cli:
name: CLI ${{ matrix.name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- name: Linux
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
asset_platform: linux-x64
bin: omninova
ext: ""
- name: macOS (Intel)
os: macos-latest
target: x86_64-apple-darwin
asset_platform: macos-intel
bin: omninova
ext: ""
- name: macOS (Apple Silicon)
os: macos-14
target: aarch64-apple-darwin
asset_platform: macos-arm64
bin: omninova
ext: ""
- name: Windows
os: windows-latest
target: x86_64-pc-windows-msvc
asset_platform: windows-x64
bin: omninova.exe
ext: ".exe"

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup MSVC
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1

- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2
with:
workspaces: . -> target

- name: Install Linux system dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y pkg-config build-essential libssl-dev

- name: Prepare CLI version
id: meta
shell: bash
run: |
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
VERSION="${GITHUB_REF_NAME#v}"
else
BRANCH_NAME="${GITHUB_REF_NAME:-branch}"
SANITIZED_BRANCH=$(echo "$BRANCH_NAME" | tr '[:upper:]' '[:lower:]' | sed 's#[^a-z0-9._-]#-#g')
VERSION="${SANITIZED_BRANCH}-sha-${GITHUB_SHA::7}"
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

- name: Build omninova CLI
shell: bash
run: cargo build --release -p omninova-core --bin omninova --target ${{ matrix.target }}

- name: Stage CLI artifact
shell: bash
run: |
set -euo pipefail
mkdir -p cli-assets
SRC="target/${{ matrix.target }}/release/${{ matrix.bin }}"
if [ ! -f "$SRC" ]; then
echo "::error::CLI binary not found at $SRC"
ls -R target/${{ matrix.target }}/release | head -50 || true
exit 1
fi
DEST="cli-assets/omninova-${{ steps.meta.outputs.version }}-${{ matrix.asset_platform }}${{ matrix.ext }}"
cp "$SRC" "$DEST"
ls -lh cli-assets/

- name: Upload CLI artifact
uses: actions/upload-artifact@v4
with:
name: release-cli-${{ matrix.asset_platform }}
path: cli-assets/**
if-no-files-found: error

release:
name: Publish GitHub Release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs:
- desktop
- android
- ios
- cli
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
Expand All @@ -530,7 +627,7 @@ jobs:
find . -mindepth 2 -name "SHA256SUMS.txt" -type f -delete
mapfile -t release_files < <(
find . -type f \
\( -name "*.dmg" -o -name "*.deb" -o -name "*.appimage" -o -name "*.rpm" -o -name "*.exe" -o -name "*.msi" -o -name "*.tar.gz" -o -name "*.apk" -o -name "*.aab" -o -name "*.ipa" \) \
\( -name "*.dmg" -o -name "*.deb" -o -name "*.appimage" -o -name "*.rpm" -o -name "*.exe" -o -name "*.msi" -o -name "*.tar.gz" -o -name "*.apk" -o -name "*.aab" -o -name "*.ipa" -o -name "omninova-*-linux-x64" -o -name "omninova-*-macos-intel" -o -name "omninova-*-macos-arm64" \) \
-print | sort
)
if [ "${#release_files[@]}" -eq 0 ]; then
Expand Down Expand Up @@ -560,6 +657,10 @@ jobs:
release-assets/**/*.apk
release-assets/**/*.aab
release-assets/**/*.ipa
release-assets/**/omninova-*-linux-x64
release-assets/**/omninova-*-macos-intel
release-assets/**/omninova-*-macos-arm64
release-assets/**/omninova-*-windows-x64.exe
release-assets/**/IOS_INSTALL.txt
release-assets/**/macOS-安装与修复.txt
release-assets/SHA256SUMS.txt
97 changes: 96 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ home = "=0.5.9"
avif-serialize = "=0.8.2"
base64ct = "=1.6.0"
qrcode = { version = "0.14", default-features = false }
calamine = "0.26"
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#Fri May 22 13:18:16 CST 2026
networkTimeout=10000
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
2 changes: 1 addition & 1 deletion apps/omninova-tauri/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "omninova-tauri",
"private": true,
"version": "0.1.0",
"version": "0.2.0-alpha.2",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
44 changes: 44 additions & 0 deletions apps/omninova-tauri/scripts/build-platform.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { spawnSync } from "node:child_process";
import { fileURLToPath } from "node:url";
import path from "node:path";
import process from "node:process";
import { platformCommands } from "./platforms.mjs";

Expand All @@ -8,6 +10,46 @@ const normalizedEnv = {
CI: process.env.CI === "1" ? "true" : process.env.CI,
};

const scriptDir = path.dirname(fileURLToPath(import.meta.url));
const srcTauriDir = path.resolve(scriptDir, "../src-tauri");

/**
* 在桌面应用打包前,先把随包 CLI(omninova 二进制)以 release 构建出来,
* 使 src-tauri/build.rs 能将其复制进 resources/cli 一并打包。
* 对带 --target 的交叉构建,传入相同 triple,保证产物路径与 build.rs 推导一致。
*/
const buildBundledCli = (command) => {
if (command.category !== "desktop" || !command.args.includes("build")) {
return;
}
const cargoArgs = [
"build",
"--release",
"-p",
"omninova-core",
"--bin",
"omninova",
];
if (command.target) {
cargoArgs.push("--target", command.target);
}
console.log(`> cargo ${cargoArgs.join(" ")}`);
const result = spawnSync("cargo", cargoArgs, {
stdio: "inherit",
cwd: srcTauriDir,
shell: process.platform === "win32",
env: normalizedEnv,
});
if (result.error) {
console.error(`构建随包 CLI 失败:${result.error.message}`);
process.exit(1);
}
if ((result.status ?? 0) !== 0) {
console.error("构建随包 CLI 失败:cargo 退出码非 0");
process.exit(result.status ?? 1);
}
};

const listCommands = () => {
console.log("Available OmniNova Tauri build commands:\n");

Expand Down Expand Up @@ -39,6 +81,8 @@ if (!command) {
process.exit(1);
}

buildBundledCli(command);

const tauriArgs = ["run", "tauri", "--", ...command.args, ...extraArgs];

console.log(`> npm ${tauriArgs.join(" ")}`);
Expand Down
Loading