diff --git a/.github/workflows/beta-build.yml b/.github/workflows/beta-build.yml index 4617b82..c5a4c72 100644 --- a/.github/workflows/beta-build.yml +++ b/.github/workflows/beta-build.yml @@ -1,8 +1,11 @@ -name: Build Beta Package +name: Build Beta on: schedule: - cron: "22 22 * * *" + pull_request: + branches: + - develop workflow_dispatch: inputs: updater: @@ -19,17 +22,17 @@ on: description: "linux" required: true type: boolean - default: false + default: true platform_macos_aarch64: description: "macos-aarch64" required: true type: boolean - default: false + default: true platform_macos_x86_64: description: "macos-x86_64" required: true type: boolean - default: false + default: true isDebug: description: "is debug?" required: true @@ -137,8 +140,6 @@ jobs: RETENTION_DAYS: ${{ needs.preprocess.outputs.retention_days }} FILE_PREFIX: ${{ needs.preprocess.outputs.file_prefix }} # BUILD_TIME: ${{ needs.preprocess.outputs.build_time }} - TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} - TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} NO_STRIP: true steps: - name: Checkout repository diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5721d05..a791cbf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,7 @@ on: pull_request: branches: - main + - develop jobs: build-test: diff --git a/.github/workflows/desktop-publish.yml b/.github/workflows/desktop-publish.yml index 0929fae..39db43d 100644 --- a/.github/workflows/desktop-publish.yml +++ b/.github/workflows/desktop-publish.yml @@ -15,16 +15,16 @@ jobs: matrix: settings: - platform: "macos-14" # for Arm based macs (M1 and above). - args: "--target aarch64-apple-darwin --verbose" + args: "--target aarch64-apple-darwin --verbose --config src-tauri/tauri.conf.publish.json" - platform: "macos-13" # for Intel based macs. - args: "--target x86_64-apple-darwin --verbose" + args: "--target x86_64-apple-darwin --verbose --config src-tauri/tauri.conf.publish.json" # Universal Build no longer supported after adding openssl, which is not cross-compilable. - platform: "macos-14" # for Both Arm and Intel based macs. - args: "--target universal-apple-darwin --verbose" + args: "--target universal-apple-darwin --verbose --config src-tauri/tauri.conf.publish.json" - platform: "ubuntu-22.04" # for Tauri v1 you could replace this with ubuntu-20.04. - args: "--verbose" + args: "--verbose --config src-tauri/tauri.conf.publish.json" - platform: "windows-latest" - args: "--verbose" + args: "--verbose --config src-tauri/tauri.conf.publish.json" runs-on: ${{ matrix.settings.platform }} steps: @@ -96,6 +96,7 @@ jobs: - uses: tauri-apps/tauri-action@v0 env: CI: false + KUNKUN_PUBLISH: true GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} diff --git a/apps/desktop/package.json b/apps/desktop/package.json index e0f97da..f0d8803 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -1,6 +1,6 @@ { "name": "@kksh/desktop", - "version": "0.1.22", + "version": "0.1.23", "description": "", "type": "module", "scripts": { diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rs index 5d7b3be..38fb2e1 100644 --- a/apps/desktop/src-tauri/src/lib.rs +++ b/apps/desktop/src-tauri/src/lib.rs @@ -9,12 +9,10 @@ use tauri::ActivationPolicy; use tauri::Manager; use tauri_plugin_deep_link::DeepLinkExt; use tauri_plugin_jarvis::{ - db::JarvisDB, - server::Protocol, - utils::{ + constants::KUNKUN_PUBLISH, db::JarvisDB, server::Protocol, utils::{ path::{get_default_extensions_dir, get_kunkun_db_path}, settings::AppSettings, - }, + } }; use tauri_plugin_keyring::KeyringExt; pub use tauri_plugin_log::fern::colors::ColoredLevelConfig; @@ -63,7 +61,10 @@ pub fn run() { // .build(), // ); // } - + if KUNKUN_PUBLISH == "true" { + println!("KUNKUN_PUBLISH: {}", KUNKUN_PUBLISH); + builder = builder.plugin(tauri_plugin_updater::Builder::new().build()); + } let shell_unlocked = true; builder = builder .plugin(tauri_plugin_single_instance::init(|app, args, cwd| { @@ -97,7 +98,6 @@ pub fn run() { .plugin(tauri_plugin_os::init()) .plugin(tauri_plugin_process::init()) .plugin(tauri_plugin_upload::init()) - .plugin(tauri_plugin_updater::Builder::new().build()) .plugin(tauri_plugin_store::Builder::default().build()) .plugin(tauri_plugin_global_shortcut::Builder::new().build()) .plugin(tauri_plugin_dialog::init()) @@ -123,7 +123,7 @@ pub fn run() { }) .register_uri_scheme_protocol("ext", |app, request| { let app_handle = app.app_handle(); - // app_handle. + let win_label = app.webview_label(); let jarvis_state = app_handle.state::(); let window_ext_map = jarvis_state.window_label_ext_map.lock().unwrap(); diff --git a/apps/desktop/src-tauri/tauri.conf.json b/apps/desktop/src-tauri/tauri.conf.json index 32f4416..a617fcc 100644 --- a/apps/desktop/src-tauri/tauri.conf.json +++ b/apps/desktop/src-tauri/tauri.conf.json @@ -35,7 +35,6 @@ "macOS": { "minimumSystemVersion": "10.15" }, - "createUpdaterArtifacts": true, "fileAssociations": [ { "ext": ["kunkun"], @@ -58,10 +57,6 @@ "fs": { "requireLiteralLeadingDot": false }, - "updater": { - "endpoints": ["https://updater.kunkun.sh"], - "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDc1NENCRjZFM0JBOEQ0ODMKUldTRDFLZzdicjlNZFhHS0ZKYk13WkdZUTFUM01LNjkvVW5Bb2x1SnB1R0crbFRuMnlRSlJ0STgK" - }, "deep-link": { "desktop": { "schemes": ["kunkun"] diff --git a/apps/desktop/src-tauri/tauri.conf.publish.json b/apps/desktop/src-tauri/tauri.conf.publish.json new file mode 100644 index 0000000..546e82b --- /dev/null +++ b/apps/desktop/src-tauri/tauri.conf.publish.json @@ -0,0 +1,11 @@ +{ + "bundle": { + "createUpdaterArtifacts": true + }, + "plugins": { + "updater": { + "endpoints": ["https://updater.kunkun.sh"], + "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDc1NENCRjZFM0JBOEQ0ODMKUldTRDFLZzdicjlNZFhHS0ZKYk13WkdZUTFUM01LNjkvVW5Bb2x1SnB1R0crbFRuMnlRSlJ0STgK" + } + } +} diff --git a/packages/tauri-plugins/jarvis/build.rs b/packages/tauri-plugins/jarvis/build.rs index 37568a7..2b29e07 100644 --- a/packages/tauri-plugins/jarvis/build.rs +++ b/packages/tauri-plugins/jarvis/build.rs @@ -125,7 +125,7 @@ const COMMANDS: &[&str] = &[ /* -------------------------------------------------------------------------- */ /* Window */ /* -------------------------------------------------------------------------- */ - "set_transparent_titlebar" + "set_transparent_titlebar", ]; fn main() { @@ -167,6 +167,10 @@ fn main() { "cargo:rustc-env=BASE64_SERVER_PUBLIC_KEY={}", BASE64_STANDARD.encode(raw_server_public_key) ); + println!( + "cargo:rustc-env=KUNKUN_PUBLISH={}", + std::env::var("KUNKUN_PUBLISH").unwrap_or("false".to_string()) + ); tauri_plugin::Builder::new(COMMANDS) .android_path("android") diff --git a/packages/tauri-plugins/jarvis/src/constants.rs b/packages/tauri-plugins/jarvis/src/constants.rs index 288febe..6cbdf06 100644 --- a/packages/tauri-plugins/jarvis/src/constants.rs +++ b/packages/tauri-plugins/jarvis/src/constants.rs @@ -20,3 +20,4 @@ pub static SERVER_PUBLIC_KEY: std::sync::LazyLock> = std::sync::LazyLock .decode(BASE64_SERVER_PUBLIC_KEY) .expect("Failed to decode base64 encoded server public key") }); +pub static KUNKUN_PUBLISH: &str = env!("KUNKUN_PUBLISH");