-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,29 @@ jobs: | |
with: | ||
fetch-depth: 0 # Workaround for bug https://github.com/actions/checkout/issues/1471 | ||
|
||
- name: Set Default Firebase Distribution Groups | ||
run: | | ||
# Define all the possible distribution groups | ||
ALL_BUILDS_GROUP="all-builds" | ||
FEATURE_BUILDS_GROUP="feature-branch" | ||
STABLE_BUILDS_GROUP="next" | ||
# Initialize with the default distribution group | ||
distribution_groups=("$ALL_BUILDS_GROUP") | ||
# Determine current app type and Git context | ||
is_primary_app=$([[ "${{ matrix.sample-app }}" == "java_layout" ]] && echo "true" || echo "false") | ||
current_branch="${GITHUB_REF}" | ||
# Append distribution groups based on branch and context if the app is primary | ||
if [[ "$is_primary_app" == "true" ]]; then | ||
[[ "$current_branch" == "refs/heads/feature/"* ]] && distribution_groups+=("$FEATURE_BUILDS_GROUP") | ||
[[ "$current_branch" == "refs/heads/main" ]] && distribution_groups+=("$STABLE_BUILDS_GROUP") | ||
fi | ||
# Export the groups as an environment variable | ||
echo "firebase_distribution_groups=$(IFS=','; echo "${distribution_groups[*]}")" >> $GITHUB_ENV | ||
- name: Get latest SDK version | ||
if: ${{ inputs.use_latest_sdk_version == true }} | ||
id: latest-sdk-version-step | ||
|
@@ -74,13 +97,32 @@ jobs: | |
- name: Dump GitHub Action metadata because Fastlane uses it. Viewing it here helps debug JSON parsing code in Firebase. | ||
run: cat $GITHUB_EVENT_PATH | ||
|
||
- name: Prepare Fastlane Build Arguments | ||
run: | | ||
if [ "${{ inputs.use_latest_sdk_version }}" = "true" ]; then | ||
sdk_version="\"sdk_version\":\"${{ steps.latest-sdk-version-step.outputs.LATEST_TAG }}\"" | ||
else | ||
sdk_version="" | ||
fi | ||
distribution_groups="\"distribution_groups\":\"${{ env.firebase_distribution_groups }}\"" | ||
# Construct the fastlane-build-args JSON | ||
if [ -n "$sdk_version" ]; then | ||
fastlane_build_args="{${sdk_version},${distribution_groups}}" | ||
else | ||
fastlane_build_args="{${distribution_groups}}" | ||
fi | ||
echo "fastlane_build_args=$fastlane_build_args" >> $GITHUB_ENV | ||
- name: Deploy build via Fastlane | ||
if: ${{ ! (inputs.use_latest_sdk_version == true && matrix.sample-app == 'kotlin_compose') }} | ||
uses: maierj/[email protected] | ||
with: | ||
lane: ${{ inputs.use_latest_sdk_version == true && 'android build_sample_app_for_sdk_release' || 'android build' }} | ||
subdirectory: "samples/${{ matrix.sample-app }}" | ||
options: ${{ inputs.use_latest_sdk_version == true && format('{{"sdk_version":"{0}"}}', steps.latest-sdk-version-step.outputs.LATEST_TAG) || '' }} | ||
options: ${{ env.fastlane_build_args }} | ||
env: | ||
ANDROID_SIGNING_ALIAS: ${{ secrets.ANDROID_SIGNING_ALIAS }} | ||
ANDROID_SIGNING_KEY_PASSWORD: ${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters