Replace the last of the fastlane lanes with swift tooling

- move more sharable code to CI static methods
- merge `release_to_github` and `prepare_next_release` into one single command as they had dependencies on each other
- remove all traces of ruby and fastlane
This commit is contained in:
Stefan Ceriu
2026-03-10 12:35:39 +02:00
committed by Stefan Ceriu
parent 96ea54e299
commit bce9119bc3
19 changed files with 211 additions and 574 deletions
+39 -1
View File
@@ -14,7 +14,8 @@ struct CI: ParsableCommand {
ConfigureNightly.self,
ConfigureProduction.self,
TagNightly.self,
UploadDSYMs.self
UploadDSYMs.self,
ReleaseToGitHub.self
])
static let testOutputDirectory = "test_output"
@@ -123,4 +124,41 @@ struct CI: ParsableCommand {
return result
}
// MARK: - Git
static func gitConfigureGlobals() async throws {
try await CI.run(.name("git"), ["config", "--global", "user.name", "Element CI"])
try await CI.run(.name("git"), ["config", "--global", "user.email", "ci@element.io"])
}
static func gitRepositoryURL() async throws -> String {
guard let rawURL = try await CI.run(.name("git"), ["ls-remote", "--get-url", "origin"],
output: .string(limit: 4096)).standardOutput else {
throw ValidationError("Could not determine the git remote URL.")
}
return rawURL
.replacingOccurrences(of: "http://", with: "")
.replacingOccurrences(of: "https://", with: "")
.replacingOccurrences(of: "git@", with: "")
.replacingOccurrences(of: ".git", with: "")
.trimmingCharacters(in: .whitespacesAndNewlines)
}
static func gitPush(tagName: String? = nil) async throws {
guard let apiToken = ProcessInfo.processInfo.environment["GITHUB_TOKEN"], !apiToken.isEmpty
else {
throw ValidationError("GITHUB_TOKEN environment variable is not set.")
}
let repoURL = try await CI.gitRepositoryURL()
if let tagName {
try await CI.run(.name("git"), ["tag", tagName])
try await CI.run(.name("git"), ["push", "https://\(apiToken)@\(repoURL)", tagName])
} else {
try await CI.run(.name("git"), ["push", "https://\(apiToken)@\(repoURL)"])
}
}
}