Skip to content

Commit

Permalink
pass api keys as env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
Full Queue Developer committed May 20, 2022
1 parent b1cbcc0 commit 534a99c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ let package = Package(
dependencies: ["Sh"]),
.testTarget(
name: "ShXcrunTests",
dependencies: ["ShXcrun"]),
dependencies: ["ShXcrun", "Sh"]),
]
)
15 changes: 4 additions & 11 deletions Sources/ShXcrun/Altool/Altool.uploadApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,11 @@ import Foundation
extension Altool {

public func uploadApp(_ sink: Sink = .terminal, file: String, platform: Platform, transport: [Transport]? = nil) throws {
let command =
"""
xcrun altool \
\(credential.serialized) \
--upload-app \
-f \(file) \
-t \(platform) \
\(transport.serialized)
"""


let cred = credential.serialized
let trans = transport.serialized
try sh(sink,
command,
"xcrun altool \(cred) -upload-app -f \(file) -t \(platform) \(trans)",
environment: self.credential.environment)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ public struct ApiKeyCredential: AltoolCredential {
let apiIssuerID: String

public var serialized: String {
"--apiKey \(apiKeyID) --apiIssuer \(apiIssuerID)"
"--apiKey $SH_XCRUN_ALTOOL_API_KEY_ID --apiIssuer $SH_XCRUN_ALTOOL_API_ISSUER_ID"
}

public var environment: [String: String] {
[
"SH_XCRUN_ALTOOL_API_KEY_ID": apiKeyID,
"SH_XCRUN_ALTOOL_API_ISSUER_ID": apiIssuerID,
]
}
}

0 comments on commit 534a99c

Please sign in to comment.