Skip to content

Commit f6ce20e

Browse files
committed
Provide crendetial
1 parent 63dc204 commit f6ce20e

File tree

3 files changed

+31
-42
lines changed

3 files changed

+31
-42
lines changed

Sources/Swiftlane/Actions/iOS/UploadASC.swift

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,17 @@
77

88
import Foundation
99

10-
public final class UploadASC {
10+
public final class UploadASC: UseALTool {
1111
public var args = Args()
1212

13-
public struct Credential {
14-
let apiIssuer: String
15-
let apiKey: String
13+
public init() {}
1614

17-
public init(
18-
apiIssuer: String,
19-
apiKey: String
20-
) {
21-
self.apiKey = apiKey
22-
self.apiIssuer = apiIssuer
23-
}
24-
}
25-
26-
let credential: Credential
27-
28-
public init(
29-
credential: Credential
15+
public func credential(
16+
apiKey: String,
17+
apiIssuer: String
3018
) {
31-
self.credential = credential
19+
args["--apiKey"] = apiKey
20+
args["--apiIssuer"] = apiIssuer
3221
}
3322
}
3423

@@ -38,8 +27,7 @@ public extension UploadASC {
3827
) async throws {
3928
args.flag("altool")
4029
args.flag("--upload-app")
41-
args["--apiKey"] = credential.apiKey
42-
args["--apiIssuer"] = credential.apiIssuer
30+
4331
args["--file"] = ipaFile.path
4432

4533
_ = try Settings.default.cli.run(

Sources/Swiftlane/Actions/macOS/Notarize.swift

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,17 @@
88
import Foundation
99
import SWXMLHash
1010

11-
public struct Notarize {
12-
public struct Credential {
13-
let username: String
14-
let password: String
15-
16-
public init(
17-
username: String,
18-
password: String
19-
) {
20-
self.username = username
21-
self.password = password
22-
}
23-
}
11+
public final class Notarize: UseALTool {
12+
public var args = Args()
2413

25-
let credential: Credential
14+
public init() {}
2615

27-
public init(credential: Credential) {
28-
self.credential = credential
16+
public func credential(
17+
username: String,
18+
password: String
19+
) {
20+
args["--username"] = username
21+
args["--password"] = password
2922
}
3023
}
3124

@@ -37,13 +30,11 @@ public extension Notarize {
3730
) async throws {
3831
Settings.default.cs.action("Notarize")
3932

40-
var args = Args()
33+
var args = self.args
4134
args.flag("altool")
4235
args.flag("--notarize-app")
4336
args["-t"] = "osx"
4437
args["--output-format"] = "xml"
45-
args["--username"] = credential.username
46-
args["--password"] = credential.password
4738
args["--file"] = packageFile.path
4839
args["--primary-bundle-id"] = bundleId
4940

@@ -111,11 +102,9 @@ public extension Notarize {
111102
}
112103

113104
private func fetchInfo(uuid: String) async throws -> String {
114-
var args = Args()
105+
var args = self.args
115106
args.flag("altool")
116107
args["--notarization-info"] = uuid
117-
args["--username"] = credential.username
118-
args["--password"] = credential.password
119108
args["-output-format"] = "xml"
120109

121110
return try Settings.default.cli.run(
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//
2+
// ALTool.swift
3+
// Swiftlane
4+
//
5+
// Created by khoa on 13/02/2022.
6+
//
7+
8+
import Foundation
9+
10+
public protocol UseALTool: AnyObject {
11+
var args: Args { get set }
12+
}

0 commit comments

Comments
 (0)