Skip to content

Commit 8ab8d52

Browse files
authored
Fix #3288: Add provider_short_name for macOS (#3289)
1 parent 9bb6897 commit 8ab8d52

File tree

8 files changed

+37
-2
lines changed

8 files changed

+37
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri-bundler": patch
3+
---
4+
5+
Provide a provider short name for macOS app notarization if your Apple developer account is connected to more than one team.

tooling/bundler/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ These settings are used only when bundling `app` and `dmg` packages.
7676
* `license`: Path to the license file for the DMG bundle.
7777
* `exception_domain`: The exception domain to use on the macOS .app bundle. Allows communication to the outside world e.g. a web server you're shipping.
7878
* `use_bootstrapper`: Enables the bootstrapper script, which allows access to the environment variables.
79+
* `provider_short_name`: If your Apple ID is connected to multiple teams, you have to specify the provider short name of the team you want to use to notarize your app. See [Customizing the notarization workflow](https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/customizing_the_notarization_workflow) and search for `--list-providers` for more information how to obtain your provider short name.
7980

8081
### Example `tauri.conf.json`:
8182

tooling/bundler/src/bundle/macos/sign.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ pub fn notarize(
258258
sign(zip_path.clone(), identity, &settings, false)?;
259259
};
260260

261-
let notarize_args = vec![
261+
let mut notarize_args = vec![
262262
"altool",
263263
"--notarize-app",
264264
"-f",
@@ -268,6 +268,12 @@ pub fn notarize(
268268
"--primary-bundle-id",
269269
identifier,
270270
];
271+
272+
if let Some(provider_short_name) = &settings.macos().provider_short_name {
273+
notarize_args.push("--asc-provider");
274+
notarize_args.push(provider_short_name);
275+
}
276+
271277
common::print_info("notarizing app")?;
272278
let output = Command::new("xcrun")
273279
.args(notarize_args)

tooling/bundler/src/bundle/settings.rs

+2
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ pub struct MacOsSettings {
168168
pub exception_domain: Option<String>,
169169
/// Code signing identity.
170170
pub signing_identity: Option<String>,
171+
/// Provider short name for notarization.
172+
pub provider_short_name: Option<String>,
171173
/// Path to the entitlements.plist file.
172174
pub entitlements: Option<String>,
173175
/// Path to the Info.plist file for the bundle.

tooling/cli.rs/config_definition.rs

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ pub struct MacConfig {
6565
pub use_bootstrapper: bool,
6666
/// Identity to use for code signing.
6767
pub signing_identity: Option<String>,
68+
/// Provider short name for notarization.
69+
pub provider_short_name: Option<String>,
6870
/// Path to the entitlements file.
6971
pub entitlements: Option<String>,
7072
}

tooling/cli.rs/schema.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,13 @@
897897
"null"
898898
]
899899
},
900+
"providerShortName": {
901+
"description": "Provider short name for notarization.",
902+
"type": [
903+
"string",
904+
"null"
905+
]
906+
},
900907
"useBootstrapper": {
901908
"description": "Enable the boostrapper script.",
902909
"default": false,
@@ -1501,4 +1508,4 @@
15011508
"additionalProperties": false
15021509
}
15031510
}
1504-
}
1511+
}

tooling/cli.rs/src/interface/rust.rs

+11
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,16 @@ fn tauri_config_to_bundle_settings(
420420
None => config.macos.signing_identity,
421421
};
422422

423+
let provider_short_name = match std::env::var_os("APPLE_PROVIDER_SHORT_NAME") {
424+
Some(provider_short_name) => Some(
425+
provider_short_name
426+
.to_str()
427+
.expect("failed to convert APPLE_PROVIDER_SHORT_NAME to string")
428+
.to_string(),
429+
),
430+
None => config.macos.provider_short_name,
431+
};
432+
423433
Ok(BundleSettings {
424434
identifier: config.identifier,
425435
icon: config.icon,
@@ -455,6 +465,7 @@ fn tauri_config_to_bundle_settings(
455465
use_bootstrapper: Some(config.macos.use_bootstrapper),
456466
exception_domain: config.macos.exception_domain,
457467
signing_identity,
468+
provider_short_name,
458469
entitlements: config.macos.entitlements,
459470
info_plist_path: {
460471
let path = tauri_dir().join("Info.plist");

tooling/cli.rs/templates/app/src-tauri/tauri.conf.json

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"useBootstrapper": false,
3838
"exceptionDomain": "",
3939
"signingIdentity": null,
40+
"providerShortName": null,
4041
"entitlements": null
4142
},
4243
"windows": {

0 commit comments

Comments
 (0)