Skip to content

Commit 5af1f5d

Browse files
authored
fix(cli): automatic signing for iOS on CI (#10851)
ref tauri-apps/cargo-mobile2#381
1 parent 5ec7445 commit 5af1f5d

File tree

4 files changed

+28
-8
lines changed

4 files changed

+28
-8
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"tauri-cli": patch:bug
3+
"@tauri-apps/cli": patch:bug
4+
---
5+
6+
Fixes `ios build` failing to build iOS app in CI when using an API key for automatic signing.

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/tauri-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ name = "cargo-tauri"
3636
path = "src/main.rs"
3737

3838
[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]
39-
cargo-mobile2 = { version = "0.15.1", default-features = false }
39+
cargo-mobile2 = { version = "0.16", default-features = false }
4040

4141
[dependencies]
4242
jsonrpsee = { version = "0.24", features = ["server"] }

crates/tauri-cli/src/mobile/ios/build.rs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use anyhow::Context;
2424
use cargo_mobile2::{
2525
apple::{
2626
config::Config as AppleConfig,
27-
target::{ExportConfig, Target},
27+
target::{BuildConfig, ExportConfig, Target},
2828
},
2929
env::Env,
3030
opts::{NoiseLevel, Profile},
@@ -299,11 +299,25 @@ fn run_build(
299299
app_version.push_extra(build_number);
300300
}
301301

302-
target.build(config, env, NoiseLevel::FranklyQuitePedantic, profile)?;
302+
let credentials = auth_credentials_from_env()?;
303+
304+
let mut build_config = BuildConfig::new().allow_provisioning_updates();
305+
if let Some(credentials) = &credentials {
306+
build_config = build_config.authentication_credentials(credentials.clone());
307+
}
308+
309+
target.build(
310+
config,
311+
env,
312+
NoiseLevel::FranklyQuitePedantic,
313+
profile,
314+
build_config,
315+
)?;
316+
303317
target.archive(config, env, noise_level, profile, Some(app_version))?;
304318

305319
let mut export_config = ExportConfig::new().allow_provisioning_updates();
306-
if let Some(credentials) = auth_credentials_from_env()? {
320+
if let Some(credentials) = credentials {
307321
export_config = export_config.authentication_credentials(credentials);
308322
}
309323

@@ -327,14 +341,14 @@ fn run_build(
327341
Ok(handle)
328342
}
329343

330-
fn auth_credentials_from_env() -> Result<Option<cargo_mobile2::apple::target::AuthCredentials>> {
344+
fn auth_credentials_from_env() -> Result<Option<cargo_mobile2::apple::AuthCredentials>> {
331345
match (
332346
var("APPLE_API_KEY"),
333347
var("APPLE_API_ISSUER"),
334348
var_os("APPLE_API_KEY_PATH").map(PathBuf::from),
335349
) {
336350
(Ok(key_id), Ok(key_issuer_id), Some(key_path)) => {
337-
Ok(Some(cargo_mobile2::apple::target::AuthCredentials {
351+
Ok(Some(cargo_mobile2::apple::AuthCredentials {
338352
key_path,
339353
key_id,
340354
key_issuer_id,

0 commit comments

Comments
 (0)