Skip to content

Commit 259e4dc

Browse files
committed
chore: build primary sample app
1 parent deda228 commit 259e4dc

File tree

2 files changed

+32
-18
lines changed

2 files changed

+32
-18
lines changed

.github/workflows/build-sample-apps.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,29 @@ jobs:
7070
- uses: actions/checkout@v4
7171

7272
# Install CLI tools, Ruby, and Ruby dependencies for Fastlane
73+
74+
- name: Set Default Firebase Distribution Groups
75+
run: |
76+
# Define all the possible distribution groups
77+
ALL_BUILDS_GROUP="all-builds"
78+
FEATURE_BUILDS_GROUP="feature-branch"
79+
STABLE_BUILDS_GROUP="next"
80+
81+
# Initialize with the default distribution group
82+
distribution_groups=("$ALL_BUILDS_GROUP")
83+
84+
# Determine current app type and Git context
85+
is_primary_app=$([[ "${{ matrix.sample-app }}" == "APN" ]] && echo "true" || echo "false")
86+
current_branch="${GITHUB_REF}"
87+
88+
# Append distribution groups based on branch and context if the app is primary
89+
if [[ "$is_primary_app" == "true" ]]; then
90+
[[ "$current_branch" == "refs/heads/feature/"* ]] && distribution_groups+=("$FEATURE_BUILDS_GROUP")
91+
[[ "$current_branch" == "refs/heads/main" ]] && distribution_groups+=("$STABLE_BUILDS_GROUP")
92+
fi
93+
94+
# Export the groups as an environment variable
95+
echo "firebase_distribution_groups=$(IFS=','; echo "${distribution_groups[*]}")" >> $GITHUB_ENV
7396
7497
- name: Install CLI tools used in CI script
7598
shell: bash

Apps/fastlane/helpers/build_helper.rb

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
apk_path: distribution_apk_path,
4242
app: firebase_app_id, # Firebase app id is required. Get it from google-services.json file
4343
service_credentials_file: service_credentials_file_path,
44-
groups: get_build_test_groups(),
44+
groups: get_build_test_groups(distribution_groups: arguments[:distribution_groups]),
4545
release_notes: get_build_notes()
4646
)
4747
end
@@ -83,7 +83,7 @@
8383

8484
firebase_app_distribution(
8585
service_credentials_file: service_credentials_file_path,
86-
groups: get_build_test_groups(),
86+
groups: get_build_test_groups(distribution_groups: arguments[:distribution_groups]),
8787
release_notes: get_build_notes()
8888
)
8989
end
@@ -123,22 +123,13 @@
123123
build_notes # return value
124124
end
125125

126-
lane :get_build_test_groups do
127-
test_groups = ['all-builds'] # send all builds to group 'all-builds'. Therefore, set it here and we will not remove it.
128-
test_groups.append("feature-branch") # Feature branch will be used when a PR is merged into a feature branch. We will need to add a check for this.
129-
github = GitHub.new()
130-
131-
# To avoid giving potentially unstable builds of our sample apps to certain members of the organization, we only send builds to "stable" group uncertain certain situations.
132-
# If a commit is merged into main, it's considered stable because we deploy to production on merges to main.
133-
if github.is_commit_pushed && github.push_branch == "main"
134-
test_groups.append("stable-builds")
135-
test_groups.append("next") # Next group will depricate the 'stable` builds group'.
136-
test_groups.append("public") # Temp send to public group until we actually build from the deployed SDK.
137-
end
138-
139-
test_groups = test_groups.join(", ")
126+
lane :get_build_test_groups do |arguments|
127+
# Firebase App Distribution expects a comma separated string of test group names.
128+
# If no groups are passed in, then set test groups to an empty string.
129+
test_groups = arguments[:distribution_groups] || ""
140130

141131
UI.important("Test group names that will be added to this build: #{test_groups}")
142132

143-
test_groups # return value
144-
end
133+
test_groups # return value
134+
end
135+

0 commit comments

Comments
 (0)