Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add team_id option for apple notarization #7775

Merged
merged 5 commits into from
Sep 15, 2023
Merged
Changes from 2 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
41 changes: 33 additions & 8 deletions tooling/bundler/src/bundle/macos/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ pub enum NotarizeAuth {
AppleId {
apple_id: String,
password: String,
team_id: Option<String>,
},
ApiKey {
key: String,
Expand All @@ -344,11 +345,21 @@ pub trait NotarytoolCmdExt {
impl NotarytoolCmdExt for Command {
fn notarytool_args(&mut self, auth: &NotarizeAuth) -> &mut Self {
match auth {
NotarizeAuth::AppleId { apple_id, password } => self
.arg("--apple-id")
.arg(apple_id)
.arg("--password")
.arg(password),
NotarizeAuth::AppleId {
apple_id,
password,
team_id,
} => {
self
.arg("--username")
.arg(apple_id)
.arg("--password")
.arg(password);
if let Some(team_id) = team_id {
self.arg("--team-id").arg(team_id);
}
self
}
NotarizeAuth::ApiKey {
key,
key_path,
Expand All @@ -365,8 +376,12 @@ impl NotarytoolCmdExt for Command {
}

pub fn notarize_auth() -> crate::Result<NotarizeAuth> {
match (var_os("APPLE_ID"), var_os("APPLE_PASSWORD")) {
(Some(apple_id), Some(apple_password)) => {
match (
var_os("APPLE_ID"),
var_os("APPLE_PASSWORD"),
var_os("APPLE_TEAM_ID"),
) {
(Some(apple_id), Some(apple_password), team_id) => {
let apple_id = apple_id
.to_str()
.expect("failed to convert APPLE_ID to string")
Expand All @@ -375,7 +390,17 @@ pub fn notarize_auth() -> crate::Result<NotarizeAuth> {
.to_str()
.expect("failed to convert APPLE_PASSWORD to string")
.to_string();
Ok(NotarizeAuth::AppleId { apple_id, password })
let team_id = team_id.map(|team_id| {
team_id
.to_str()
.expect("failed to convert APPLE_TEAM_ID to string")
.to_string()
});
Ok(NotarizeAuth::AppleId {
apple_id,
password,
team_id,
})
}
_ => {
match (var_os("APPLE_API_KEY"), var_os("APPLE_API_ISSUER"), var("APPLE_API_KEY_PATH")) {
Expand Down
Loading