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

[Infra] Fix auto-tagging in release_testing_setup.sh for prerelease.yml #13427

Merged
merged 11 commits into from
Jul 31, 2024
14 changes: 3 additions & 11 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ jobs:
runs-on: macos-14
env:
bot_token_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
# The SDK repo will be cloned to this dir and podspecs from
# 'podspec_repo_branch' of this repo will be validated and pushed to the
# testing repo.
local_sdk_repo_dir: /tmp/test/firebase-ios-sdk
local_repo: specstesting
podspec_repo_branch: main
outputs:
Expand All @@ -41,7 +37,6 @@ jobs:
run: |
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
env:
Expand Down Expand Up @@ -69,8 +64,8 @@ jobs:
with:
name: firebase-ios-sdk
path: |
${{ env.local_sdk_repo_dir }}/*.podspec
${{ env.local_sdk_repo_dir }}/*.podspec.json
*.podspec
*.podspec.json
buildup_SpecsTesting_repo_FirebaseCore:
needs: specs_checking
# Don't run on private repo unless it is a PR.
Expand Down Expand Up @@ -163,7 +158,6 @@ jobs:
env:
bot_token_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
local_repo: specstesting
local_sdk_repo_dir: /tmp/test/firebase-ios-sdk
podspec_repo_branch: main
steps:
- uses: actions/checkout@v4
Expand All @@ -176,15 +170,13 @@ jobs:
# Update/create a nightly tag to the head of the main branch.
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
env:
BOT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Push updated podspecs
run: |
botaccess=`cat bot-access.txt`
cd "${local_sdk_repo_dir}"
# Changes in post submit tests will be fetched by getting diff between
# the HEAD and HEAD^ of the main branch.
common_commit=$(git rev-parse HEAD^)
Expand All @@ -205,7 +197,7 @@ jobs:
cd scripts/create_spec_repo/
swift build
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' "https://github.com/firebase/SpecsDev.git" "https://github.com/firebase/SpecsStaging.git" "https://cdn.cocoapods.org/" "FirebaseFirestoreTestingSupport" "FirebaseAuthTestingSupport" "FirebaseCombineSwift" --keep-repo --include-pods "${updated_podspecs[@]}"
BOT_TOKEN="${botaccess}" .build/debug/spec-repo-builder --sdk-repo $(pwd) --local-spec-repo-name "${local_repo}" --sdk-repo-name SpecsTesting --github-account Firebase --pod-sources 'https://${BOT_TOKEN}@github.com/Firebase/SpecsTesting' "https://github.com/firebase/SpecsDev.git" "https://github.com/firebase/SpecsStaging.git" "https://cdn.cocoapods.org/" "FirebaseFirestoreTestingSupport" "FirebaseAuthTestingSupport" "FirebaseCombineSwift" --keep-repo --include-pods "${updated_podspecs[@]}"

abtesting_quickstart:
# Don't run on private repo unless it is a PR.
Expand Down
23 changes: 16 additions & 7 deletions scripts/release_testing_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,26 @@ if [ -f "${HOME}/.cocoapods/repos" ]; then
find "${HOME}/.cocoapods/repos" -type d -maxdepth 1 -exec sh -c 'pod repo remove $(basename {})' \;
fi

mkdir -p "${local_sdk_repo_dir}"
echo "git clone from github.com/firebase/firebase-ios-sdk.git to ${local_sdk_repo_dir}"
set +x
# Using token here to update tags later.
git clone -q https://"${BOT_TOKEN}"@github.com/firebase/firebase-ios-sdk.git "${local_sdk_repo_dir}"
set -x
if [ "$TESTINGMODE" = "release_testing" ]; then
mkdir -p "${local_sdk_repo_dir}"
echo "git clone from github.com/firebase/firebase-ios-sdk.git to ${local_sdk_repo_dir}"
set +x
# Using token here to update tags later.
git clone -q https://"${BOT_TOKEN}"@github.com/firebase/firebase-ios-sdk.git "${local_sdk_repo_dir}"
set -x
cd "${local_sdk_repo_dir}"
elif [ "$TESTINGMODE" = "prerelease_testing" ]; then
git fetch --tags origin main
git checkout main
fi
ncooke3 marked this conversation as resolved.
Show resolved Hide resolved

cd "${local_sdk_repo_dir}"
# The chunk below is to determine the latest version by searching
# Get the latest released tag Cocoapods-X.Y.Z for release and prerelease testing, beta version will be excluded.
test_version=$(git tag -l --sort=-version:refname --merged main CocoaPods-*[0-9] | head -n 1)
if [ -z "$test_version" ]; then
ncooke3 marked this conversation as resolved.
Show resolved Hide resolved
echo "Latest tag could not be found. Exiting." >&2
exit 1
fi

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