Skip to content

Commit 90a1aff

Browse files
authored
Update release workflow to update spec repo. (#6335)
1 parent 5fa3c32 commit 90a1aff

File tree

6 files changed

+103
-5
lines changed

6 files changed

+103
-5
lines changed

.github/workflows/release.yml

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,71 @@ on:
44
pull_request:
55
paths:
66
- '.github/workflows/release.yml'
7+
- 'scripts/create_spec_repo/*'
78
schedule:
89
# Run every day at 11pm (PST) - cron uses UTC times
910
- cron: '0 7 * * *'
1011

1112
jobs:
13+
buildup_SpecsTesting_repo:
14+
# Don't run on private repo unless it is a PR.
15+
if: github.repository != 'FirebasePrivate/firebase-ios-sdk' || github.event_name == 'pull_request'
16+
env:
17+
bot_token_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
18+
local_repo: specstesting
19+
local_sdk_repo_dir: /tmp/test/firebase-ios-sdk
20+
podspec_repo_branch: master
21+
runs-on: macOS-latest
22+
steps:
23+
- uses: actions/checkout@v2
24+
- name: Get token
25+
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/bot-access.txt.gpg \
26+
bot-access.txt "$bot_token_secret"
27+
- name: Update SpecStaging repo setup
28+
run: scripts/release_testing_setup.sh
29+
- name: Update SpecStaging repo
30+
run: |
31+
botaccess=`cat bot-access.txt`
32+
cd scripts/create_spec_repo/
33+
swift build
34+
pod repo add --silent "${local_repo}" https://"$botaccess"@github.com/FirebasePrivate/SpecsTesting.git
35+
BOT_TOKEN="${botaccess}" .build/debug/SpecRepoBuilder --sdk_repo "${local_sdk_repo_dir}" --local_spec_repo_name "${local_repo}"
36+
- name: Clean Artifacts
37+
if: ${{ always() }}
38+
run: |
39+
pod repo remove "${local_repo}"
40+
rm -rf bot-access.txt
41+
- uses: actions/upload-artifact@v2
42+
with:
43+
name: firebase-ios-sdk
44+
path: /tmp/test/firebase-ios-sdk
1245

1346
quickstart_release_test:
1447
# Don't run on private repo unless it is a PR.
1548
if: github.repository != 'FirebasePrivate/firebase-ios-sdk' || github.event_name == 'pull_request'
49+
needs: buildup_SpecsTesting_repo
1650
env:
1751
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
1852
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
53+
bot_token_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
54+
testing_repo_dir: "/tmp/test/"
55+
testing_repo: "firebase-ios-sdk"
1956
runs-on: macOS-latest
2057
steps:
2158
- uses: actions/checkout@v2
22-
- name: Setup quickstart
23-
run: scripts/setup_quickstart.sh config release_testing
59+
- name: Get token
60+
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/bot-access.txt.gpg \
61+
bot-access.txt "$bot_token_secret"
62+
- name: Get testing podspec repo
63+
uses: actions/download-artifact@v1
64+
with:
65+
name: firebase-ios-sdk
66+
- name: Setup testing repo and quickstart
67+
run: |
68+
mkdir -p "${testing_repo_dir}"
69+
mv "${GITHUB_WORKSPACE}/${testing_repo}" "${testing_repo_dir}"
70+
botaccess=`cat bot-access.txt`
71+
BOT_TOKEN="${botaccess}" scripts/setup_quickstart.sh config release_testing
2472
- name: Install Secret GoogleService-Info.plist
2573
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-config.plist.gpg \
2674
quickstart-ios/config/GoogleService-Info.plist "$plist_secret"
@@ -30,7 +78,7 @@ jobs:
3078
- name: Test Swift Quickstart
3179
run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Config)
3280
- name: Remove data before upload
33-
run: scripts/remove_data.sh config
81+
run: scripts/remove_data.sh config release_testing
3482
- uses: actions/upload-artifact@v2
3583
if: ${{ failure() }}
3684
with:

ZipBuilder/Sources/firebase-pod-updater/main.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ struct FirebasePodUpdater: ParsableCommand {
4949

5050
let newVersions = getExpectedVersions()
5151
updateFirebasePod(newVersions: newVersions)
52-
print("Updating Firebase pod for version \(String(describing: newVersions["Firebase"]!))")
52+
if let firebase_version = newVersions["Firebase"] {
53+
print("Updating Firebase pod for version \(String(describing: firebase_version))")
54+
}
5355

5456
// Get the time since the tool start.
5557
let secondsSinceStart = -Int(buildStart.timeIntervalSinceNow)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Config file to update versions of Pods which will be pushed to SpecsStaging
2+
# repo by add_podspec tool.
3+
# e.g.
4+
# Podspec versions will be the same as firebase-ios-sdk podspecs if they are not
5+
# specified in this file.

scripts/release_testing_setup.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2020 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
set -x
16+
17+
if [ -f "${HOME}/.cocoapods/repos" ]; then
18+
find "${HOME}/.cocoapods/repos" -type d -maxdepth 1 -exec sh -c 'pod repo remove $(basename {})' \;
19+
fi
20+
git config --global user.email "[email protected]"
21+
git config --global user.name "google-oss-bot"
22+
mkdir -p /tmp/test/firebase-ios-sdk
23+
git clone -b "${podspec_repo_branch}" https://github.com/firebase/firebase-ios-sdk.git "${local_sdk_repo_dir}"
24+
cd "${local_sdk_repo_dir}"
25+
git tag -a "test" -m "release testing"
26+
# Update source and tag, e.g. ":git => 'https://github.com/firebase/firebase-ios-sdk.git'" to
27+
# ":git => /tmp/test/firebase-ios-sdk"
28+
sed -i "" "s/\s*:git.*/:git => '${local_sdk_repo_dir}',/; s/\s*:tag.*/:tag => 'test'/" *.podspec
29+
cd "${GITHUB_WORKSPACE}/ZipBuilder"
30+
swift build
31+
# Update Pod versions.
32+
./.build/debug/firebase-pod-updater --git-root "${local_sdk_repo_dir}" --releasing-pods "${GITHUB_WORKSPACE}/scripts/create_spec_repo/firebase_sdk.textproto"

scripts/remove_data.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,10 @@
1515
set -x
1616

1717
SDK="$1"
18+
MODE=${2-}
19+
if [ "$MODE" == "release_testing"]; then
20+
echo "Update podfiles release_testing."
21+
sed -i "" "s/https:\/\/.*@github.com\/FirebasePrivate\/SpecsTesting.git/https:\/\/github.com\/FirebasePrivate\/SpecsTesting.git/g" quickstart-ios/"${SDK}"/Podfile quickstart-ios/"${SDK}"/Podfile.lock
22+
fi
1823
rm -f quickstart-ios/"${SDK}"/GoogleService-Info.plist
1924
rm -f quickstart-ios/TestUtils/FIREGSignInInfo.h

scripts/setup_quickstart.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,20 @@ if check_secrets || [[ ${SAMPLE} == "installations" ]]; then
4040

4141
git clone https://github.com/firebase/quickstart-ios.git
4242
$scripts_dir/localize_podfile.swift quickstart-ios/"$SAMPLE"/Podfile "$RELEASE_TESTING"
43+
if [ ! -z "$RELEASE_TESTING" ]; then
44+
set +x
45+
sed -i "" '1i\'$'\n'"source 'https://${BOT_TOKEN}@github.com/FirebasePrivate/SpecsTesting.git'"$'\n' quickstart-ios/"$SAMPLE"/Podfile
46+
set -x
47+
echo "Podfile is updated."
48+
fi
4349
cd quickstart-ios/"$SAMPLE"
4450

4551
# To test a branch, uncomment the following line
4652
# git checkout {BRANCH_NAME}
4753

4854
bundle update --bundler
4955
bundle install
50-
bundle exec pod install
56+
bundle exec pod install --silent
5157

5258
# Add GoogleService-Info.plist to Xcode project
5359
ruby ../scripts/info_script.rb "${SAMPLE}"

0 commit comments

Comments
 (0)