case projectNameSettingError(String)
case packageBuildError(String)
case packageSigningError(String)
+ case packageNotarisationError(String)
}
func buildPackage(buildWorkPath: String, productPath: String) throws -> String {
try fm.moveItem(atPath: packagePathNew, toPath: packagePath)
}
+func notarisePackage(
+ packagePath: String, appleId: String, applePassword: String, appleTeamId: String
+) throws {
+ guard shell("xcrun notarytool submit \(packagePath) --apple-id \(appleId) --password \(applePassword) --team-id \(appleTeamId) --wait") == 0 else {
+ throw PackagingError.packageNotarisationError("Failure when notarising package!")
+ }
+ guard shell("xcrun stapler staple \(packagePath)") == 0 else {
+ throw PackagingError.packageNotarisationError("Could not staple notarisation on package!")
+ }
+}
+
@Option(name: [.long], help: "Git clone command; include options such as depth.")
var gitCloneCommand = "git clone --depth=1"
+ @Option(name: [.long], help: "Apple ID, used for notarisation.")
+ var appleId: String?
+
+ @Option(name: [.long], help: "Apple ID password, used for notarisation.")
+ var applePassword: String?
+
+ @Option(name: [.long], help: "Apple Team ID, used for notarisation.")
+ var appleTeamId: String?
+
@Option(name: [.long], help: "Apple package signing ID.")
var packageSigningId: String?
if let packageSigningId {
try signPackage(packagePath: packagePath, packageSigningId: packageSigningId)
+
+ if let appleId, let applePassword, let appleTeamId {
+ try notarisePackage(
+ packagePath: packagePath,
+ appleId: appleId,
+ applePassword: applePassword,
+ appleTeamId: appleTeamId
+ )
+ }
}
}