diff --git a/.changes/fix-ios-signing-api-key.md b/.changes/fix-ios-signing-api-key.md new file mode 100644 index 000000000..5ee29c319 --- /dev/null +++ b/.changes/fix-ios-signing-api-key.md @@ -0,0 +1,6 @@ +--- +"tauri-cli": patch:bug +"@tauri-apps/cli": patch:bug +--- + +Fixes `ios build` failing to build iOS app in CI when using an API key for automatic signing. diff --git a/Cargo.lock b/Cargo.lock index c697efdfc..15e0e8f2d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -747,9 +747,9 @@ dependencies = [ [[package]] name = "cargo-mobile2" -version = "0.15.1" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0b8132519bea2d46174e777bd36d480d93afbe1df31c27cacfb411ff152bba1" +checksum = "e188b5be2e86ea9c384075d5f5560edea7b0c8b6a06553c7ab0aa61a4475f623" dependencies = [ "colored", "core-foundation 0.10.0", diff --git a/crates/tauri-cli/Cargo.toml b/crates/tauri-cli/Cargo.toml index 466862a2b..139f77462 100644 --- a/crates/tauri-cli/Cargo.toml +++ b/crates/tauri-cli/Cargo.toml @@ -36,7 +36,7 @@ name = "cargo-tauri" path = "src/main.rs" [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\", target_os = \"windows\", target_os = \"macos\"))".dependencies] -cargo-mobile2 = { version = "0.15.1", default-features = false } +cargo-mobile2 = { version = "0.16", default-features = false } [dependencies] jsonrpsee = { version = "0.24", features = ["server"] } diff --git a/crates/tauri-cli/src/mobile/ios/build.rs b/crates/tauri-cli/src/mobile/ios/build.rs index fdcbc0f83..d85bf02ea 100644 --- a/crates/tauri-cli/src/mobile/ios/build.rs +++ b/crates/tauri-cli/src/mobile/ios/build.rs @@ -24,7 +24,7 @@ use anyhow::Context; use cargo_mobile2::{ apple::{ config::Config as AppleConfig, - target::{ExportConfig, Target}, + target::{BuildConfig, ExportConfig, Target}, }, env::Env, opts::{NoiseLevel, Profile}, @@ -299,11 +299,25 @@ fn run_build( app_version.push_extra(build_number); } - target.build(config, env, NoiseLevel::FranklyQuitePedantic, profile)?; + let credentials = auth_credentials_from_env()?; + + let mut build_config = BuildConfig::new().allow_provisioning_updates(); + if let Some(credentials) = &credentials { + build_config = build_config.authentication_credentials(credentials.clone()); + } + + target.build( + config, + env, + NoiseLevel::FranklyQuitePedantic, + profile, + build_config, + )?; + target.archive(config, env, noise_level, profile, Some(app_version))?; let mut export_config = ExportConfig::new().allow_provisioning_updates(); - if let Some(credentials) = auth_credentials_from_env()? { + if let Some(credentials) = credentials { export_config = export_config.authentication_credentials(credentials); } @@ -327,14 +341,14 @@ fn run_build( Ok(handle) } -fn auth_credentials_from_env() -> Result> { +fn auth_credentials_from_env() -> Result> { match ( var("APPLE_API_KEY"), var("APPLE_API_ISSUER"), var_os("APPLE_API_KEY_PATH").map(PathBuf::from), ) { (Ok(key_id), Ok(key_issuer_id), Some(key_path)) => { - Ok(Some(cargo_mobile2::apple::target::AuthCredentials { + Ok(Some(cargo_mobile2::apple::AuthCredentials { key_path, key_id, key_issuer_id,