Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add publish option to release tooling #6792

Merged
merged 1 commit into from
Oct 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions ReleaseTooling/Sources/FirebaseReleaser/Push.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,40 @@ import Foundation
import FirebaseManifest
import Utils

private enum Destination {
case cpdc, trunk
}

enum Push {
static func pushPodsToCPDC(gitRoot: URL) {
push(to: .cpdc, gitRoot: gitRoot)
}

static func publishPodsToTrunk(gitRoot: URL) {
push(to: .trunk, gitRoot: gitRoot)
}

private static func push(to destination: Destination, gitRoot: URL) {
let cpdcLocation = findCpdc(gitRoot: gitRoot)
let manifest = FirebaseManifest.shared

for pod in manifest.pods.filter({ $0.releasing }) {
let warningsOK = pod.allowWarnings ? " --allow-warnings" : ""
let warningsOK = pod.allowWarnings ? "--allow-warnings" : ""

let command: String = {
switch destination {
case .cpdc:
return "pod repo push --skip-tests --use-json \(warningsOK) \(cpdcLocation) " +
pod.skipImportValidation() + " \(pod.podspecName()) " +
"--sources=sso://cpdc-internal/firebase.git,https://cdn.cocoapods.org"

Shell.executeCommand("pod repo push --skip-tests --use-json \(warningsOK) \(cpdcLocation) " +
pod.skipImportValidation() + " \(pod.podspecName()) " +
"--sources=sso://cpdc-internal/firebase.git,https://cdn.cocoapods.org",
workingDir: gitRoot)
case .trunk:
return "pod trunk push --skip-tests --synchronous \(warningsOK) " +
pod.skipImportValidation() + " ~/.cocoapods/repos/\(cpdcLocation)/Specs/\(pod.name)/" +
"\(manifest.versionString(pod))/\(pod.name).podspec.json"
}
}()
Shell.executeCommand(command, workingDir: gitRoot)
}
}

Expand Down
13 changes: 10 additions & 3 deletions ReleaseTooling/Sources/FirebaseReleaser/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ struct FirebaseReleaser: ParsableCommand {
help: "Initialize the release branch")
var initBranch: Bool

/// Set this option to update podspecs only.
/// Set this option to output the commands to generate the ordered `pod trunk push` commands.
@Option(default: false,
help: "Publish the podspecs to the CocoaPodsTrunk")
var publish: Bool

/// Set this option to only update the podspecs on cpdc.
@Option(default: false,
help: "Update the podspecs only")
var pushOnly: Bool
Expand Down Expand Up @@ -68,10 +73,12 @@ struct FirebaseReleaser: ParsableCommand {
workingDir: gitRoot)
Tags.createTags(gitRoot: gitRoot)
Push.pushPodsToCPDC(gitRoot: gitRoot)
} else if pushOnly {
Push.pushPodsToCPDC(gitRoot: gitRoot)
} else if updateTagsOnly {
Tags.updateTags(gitRoot: gitRoot)
} else if pushOnly {
Push.pushPodsToCPDC(gitRoot: gitRoot)
} else if publish {
Push.publishPodsToTrunk(gitRoot: gitRoot)
}
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/build_zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fi
# output directory.
OUTPUT_DIR="$REPO/$1"

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