Skip to content
Merged
34 changes: 17 additions & 17 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- cron: '0 7 * * *'

jobs:
buildup_SpecsReleasing_repo:
buildup_SpecsTesting_repo:
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
env:
Expand All @@ -31,17 +31,17 @@ jobs:
oss-bot-access.txt "$bot_token_secret"
scripts/decrypt_gha_secret.sh scripts/gha-encrypted/bot-access.txt.gpg \
bot-access.txt "$bot_token_secret"
- name: Update SpecsReleasing repo setup
- name: Update SpecsTesting repo setup
run: |
ossbotaccess=`cat oss-bot-access.txt`
BOT_TOKEN="${ossbotaccess}" test_version="${nightly_version}" sdk_version_config="${GITHUB_WORKSPACE}/scripts/create_spec_repo/RC_firebase_sdk.textproto" local_sdk_repo_dir="${local_sdk_repo_dir}" podspec_repo_branch="${podspec_repo_branch}" scripts/release_testing_setup.sh prerelease_testing
- name: Update SpecsReleasing repo
- name: Update SpecsTesting repo
run: |
botaccess=`cat bot-access.txt`
cd scripts/create_spec_repo/
swift build
pod repo add --silent "${local_repo}" https://"$botaccess"@github.com/FirebasePrivate/SpecsReleasing.git
BOT_TOKEN="${botaccess}" .build/debug/spec-repo-builder --sdk-repo "${local_sdk_repo_dir}" --local-spec-repo-name "${local_repo}" --sdk-repo-name SpecsReleasing --pod-sources 'https://${BOT_TOKEN}@github.com/FirebasePrivate/SpecsReleasing' --pod-sources "https://github.com/firebase/SpecsDev.git" --pod-sources "https://github.com/firebase/SpecsStaging.git" --pod-sources "https://cdn.cocoapods.org/"
pod repo add --silent "${local_repo}" https://"$botaccess"@github.com/Firebase/SpecsTesting.git
BOT_TOKEN="${botaccess}" .build/debug/spec-repo-builder --sdk-repo "${local_sdk_repo_dir}" --local-spec-repo-name "${local_repo}" --sdk-repo-name SpecsTesting --github-account Firebase --pod-sources 'https://${BOT_TOKEN}@github.com/Firebase/SpecsTesting' --pod-sources "https://github.com/firebase/SpecsDev.git" --pod-sources "https://github.com/firebase/SpecsStaging.git" --pod-sources "https://cdn.cocoapods.org/"
- name: Clean Artifacts
if: ${{ always() }}
run: |
Expand All @@ -52,7 +52,7 @@ jobs:
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'

needs: buildup_SpecsReleasing_repo
needs: buildup_SpecsTesting_repo
env:
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
auth_quickstart:
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
needs: buildup_SpecsReleasing_repo
needs: buildup_SpecsTesting_repo
env:
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
crashlytics_quickstart:
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
needs: buildup_SpecsReleasing_repo
needs: buildup_SpecsTesting_repo
env:
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
Expand Down Expand Up @@ -163,7 +163,7 @@ jobs:
database_quickstart:
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
needs: buildup_SpecsReleasing_repo
needs: buildup_SpecsTesting_repo
env:
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
Expand Down Expand Up @@ -201,7 +201,7 @@ jobs:
dynamiclinks_quickstart:
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
needs: buildup_SpecsReleasing_repo
needs: buildup_SpecsTesting_repo
env:
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
Expand Down Expand Up @@ -245,7 +245,7 @@ jobs:
firestore_quickstart:
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
needs: buildup_SpecsReleasing_repo
needs: buildup_SpecsTesting_repo
env:
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
Expand Down Expand Up @@ -282,7 +282,7 @@ jobs:
functions_quickstart:
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
needs: buildup_SpecsReleasing_repo
needs: buildup_SpecsTesting_repo
env:
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
Expand Down Expand Up @@ -324,7 +324,7 @@ jobs:
inappmessaging_quickstart:
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
needs: buildup_SpecsReleasing_repo
needs: buildup_SpecsTesting_repo
env:
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
Expand Down Expand Up @@ -364,7 +364,7 @@ jobs:
messaging_quickstart:
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
needs: buildup_SpecsReleasing_repo
needs: buildup_SpecsTesting_repo
env:
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
Expand Down Expand Up @@ -404,7 +404,7 @@ jobs:
remoteconfig_quickstart:
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
needs: buildup_SpecsReleasing_repo
needs: buildup_SpecsTesting_repo
env:
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
Expand Down Expand Up @@ -438,7 +438,7 @@ jobs:
storage_quickstart:
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
needs: buildup_SpecsReleasing_repo
needs: buildup_SpecsTesting_repo
env:
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
Expand Down Expand Up @@ -476,7 +476,7 @@ jobs:
performance_quickstart:
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
needs: buildup_SpecsReleasing_repo
needs: buildup_SpecsTesting_repo
env:
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
Expand Down
31 changes: 27 additions & 4 deletions scripts/create_spec_repo/Sources/SpecRepoBuilder/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extension Constants {
static let skipLinesWithWords = ["unit_tests", "test_spec"]
static let dependencyLineSeparators = CharacterSet(charactersIn: " ,/")
static let podSources = [
"https://${BOT_TOKEN}@github.com/FirebasePrivate/SpecsTesting",
"https://${BOT_TOKEN}@github.com/Firebase/SpecsTesting",
"https://github.com/firebase/SpecsStaging.git",
"https://cdn.cocoapods.org/",
]
Expand Down Expand Up @@ -100,6 +100,8 @@ enum SpecRepoBuilderError: Error {
case failedToPush(pods: [String])
// Error occurs when a podspec is not found in the repo.
case podspecNotFound(_ podspec: String, from: String)
// Error occurs when a direotyr path cannot be determined.
case pathNotFound(_ path: String)
}

struct SpecRepoBuilder: ParsableCommand {
Expand Down Expand Up @@ -258,10 +260,31 @@ struct SpecRepoBuilder: ParsableCommand {
)
let fileManager = FileManager.default
do {
let dirs = try fileManager.contentsOfDirectory(atPath: "\(repoPath)/\(sdkRepoName)")
let sdk_repo_path = "\(repoPath)/\(sdkRepoName)"
print("The repo path is \(sdk_repo_path)")
guard let repo_url = URL(string: sdk_repo_path) else {
print("Error: cannot find \(sdk_repo_path).")
Self
.exit(withError: SpecRepoBuilderError
.pathNotFound(sdk_repo_path))
}
// Skip hidden files, e.g. /.git
let dirs = try fileManager.contentsOfDirectory(
at: repo_url,
includingPropertiesForKeys: nil,
options: [.skipsHiddenFiles]
)
print("Found following unhidden dirs: \(dirs)")
for dir in dirs {
if dir != ".git" {
shell.run("cd \(sdkRepoName); git rm -r \(dir)")
guard let isDir = (try dir.resourceValues(forKeys: [.isDirectoryKey])).isDirectory else {
print("Error: cannot determine if \(dir.path) is a directory or not.")
Self
.exit(withError: SpecRepoBuilderError
.pathNotFound(dir.path))
}
if isDir {
print("Removing \(dir.path)")
shell.run("cd \(sdkRepoName); git rm -r \(dir.path)")
}
}
shell.run("cd \(sdkRepoName); git commit -m 'Empty repo'; git push")
Expand Down
2 changes: 1 addition & 1 deletion scripts/release_testing_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fi

if [ -z $podspec_repo_branch ];then
# Get release branch, origin/release-X.Y.Z.
podspec_repo_branch=$(echo $release_branch | sed -n 's/[[:blank:]]//p')
podspec_repo_branch=$(echo $release_branch | sed -n 's/\s*//p')
fi

git config --global user.email "google-oss-bot@example.com"
Expand Down