Skip to content

Commit eb815c6

Browse files
authored
Add publish option to release tooling (#6792)
1 parent 9404f28 commit eb815c6

File tree

3 files changed

+38
-9
lines changed

3 files changed

+38
-9
lines changed

ReleaseTooling/Sources/FirebaseReleaser/Push.swift

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,40 @@ import Foundation
1919
import FirebaseManifest
2020
import Utils
2121

22+
private enum Destination {
23+
case cpdc, trunk
24+
}
25+
2226
enum Push {
2327
static func pushPodsToCPDC(gitRoot: URL) {
28+
push(to: .cpdc, gitRoot: gitRoot)
29+
}
30+
31+
static func publishPodsToTrunk(gitRoot: URL) {
32+
push(to: .trunk, gitRoot: gitRoot)
33+
}
34+
35+
private static func push(to destination: Destination, gitRoot: URL) {
2436
let cpdcLocation = findCpdc(gitRoot: gitRoot)
2537
let manifest = FirebaseManifest.shared
2638

2739
for pod in manifest.pods.filter({ $0.releasing }) {
28-
let warningsOK = pod.allowWarnings ? " --allow-warnings" : ""
40+
let warningsOK = pod.allowWarnings ? "--allow-warnings" : ""
41+
42+
let command: String = {
43+
switch destination {
44+
case .cpdc:
45+
return "pod repo push --skip-tests --use-json \(warningsOK) \(cpdcLocation) " +
46+
pod.skipImportValidation() + " \(pod.podspecName()) " +
47+
"--sources=sso://cpdc-internal/firebase.git,https://cdn.cocoapods.org"
2948

30-
Shell.executeCommand("pod repo push --skip-tests --use-json \(warningsOK) \(cpdcLocation) " +
31-
pod.skipImportValidation() + " \(pod.podspecName()) " +
32-
"--sources=sso://cpdc-internal/firebase.git,https://cdn.cocoapods.org",
33-
workingDir: gitRoot)
49+
case .trunk:
50+
return "pod trunk push --skip-tests --synchronous \(warningsOK) " +
51+
pod.skipImportValidation() + " ~/.cocoapods/repos/\(cpdcLocation)/Specs/\(pod.name)/" +
52+
"\(manifest.versionString(pod))/\(pod.name).podspec.json"
53+
}
54+
}()
55+
Shell.executeCommand(command, workingDir: gitRoot)
3456
}
3557
}
3658

ReleaseTooling/Sources/FirebaseReleaser/main.swift

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ struct FirebaseReleaser: ParsableCommand {
3838
help: "Initialize the release branch")
3939
var initBranch: Bool
4040

41-
/// Set this option to update podspecs only.
41+
/// Set this option to output the commands to generate the ordered `pod trunk push` commands.
42+
@Option(default: false,
43+
help: "Publish the podspecs to the CocoaPodsTrunk")
44+
var publish: Bool
45+
46+
/// Set this option to only update the podspecs on cpdc.
4247
@Option(default: false,
4348
help: "Update the podspecs only")
4449
var pushOnly: Bool
@@ -68,10 +73,12 @@ struct FirebaseReleaser: ParsableCommand {
6873
workingDir: gitRoot)
6974
Tags.createTags(gitRoot: gitRoot)
7075
Push.pushPodsToCPDC(gitRoot: gitRoot)
71-
} else if pushOnly {
72-
Push.pushPodsToCPDC(gitRoot: gitRoot)
7376
} else if updateTagsOnly {
7477
Tags.updateTags(gitRoot: gitRoot)
78+
} else if pushOnly {
79+
Push.pushPodsToCPDC(gitRoot: gitRoot)
80+
} else if publish {
81+
Push.publishPodsToTrunk(gitRoot: gitRoot)
7582
}
7683
}
7784

scripts/build_zip.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fi
2525
# output directory.
2626
OUTPUT_DIR="$REPO/$1"
2727

28-
cd ReleaseToolings
28+
cd ReleaseTooling
2929
swift run zip-builder -keepBuildArtifacts true -updatePodRepo true \
3030
-templateDir "${REPO}"/ReleaseTooling/Template -localPodspecPath "${REPO}" \
3131
-outputDir "${OUTPUT_DIR}" -customSpecRepos https://github.com/firebase/SpecsStaging.git

0 commit comments

Comments
 (0)