5555 fetch-depth : 0 # Workaround for bug https://github.com/actions/checkout/issues/1471
5656
5757 # Install CLI tools, Ruby, and Ruby dependencies for Fastlane
58-
58+
59+ - name : Set IS_PRIMARY_APP
60+ run : |
61+ if [[ "${{ inputs.app_name }}" == "APN" ]]; then
62+ echo "IS_PRIMARY_APP=true" >> $GITHUB_ENV
63+ else
64+ echo "IS_PRIMARY_APP=false" >> $GITHUB_ENV
65+ fi
66+
5967 - name : Set Default Firebase Distribution Groups
6068 shell : bash
6169 env :
6573 NEXT_BUILDS_GROUP : next
6674 PUBLIC_BUILDS_GROUP : public
6775 # Input variables
68- IS_PRIMARY_APP : ${{ inputs.app_name == 'APN' }}
6976 CURRENT_BRANCH : ${{ github.ref }}
7077 run : |
7178 # Initialize with the default distribution group
@@ -140,10 +147,13 @@ jobs:
140147 APP_VERSION_NAME : ${{ env.APP_VERSION_NAME }}
141148 APP_VERSION_CODE : ${{ env.APP_VERSION_CODE }}
142149
150+ - name : Set Git Context Variables
151+ run : |
152+ echo "BRANCH_NAME=${{ github.head_ref || github.ref_name }}" >> $GITHUB_ENV
153+ COMMIT_HASH="${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}"
154+ echo "COMMIT_HASH=${COMMIT_HASH:0:7}" >> $GITHUB_ENV
155+
143156 - name : Setup workspace credentials in React Native environment files
144- env :
145- BRANCH_NAME : ${{ github.head_ref || github.ref_name }}
146- COMMIT_HASH : ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
147157 run : |
148158 # Determine the correct file extension (.js or .ts)
149159 if [ -f "env.sample.js" ]; then
@@ -162,8 +172,8 @@ jobs:
162172 sd "cdpApiKey: '.*'" "cdpApiKey: '${{ secrets[format('CUSTOMERIO_{0}_WORKSPACE_CDP_API_KEY', inputs.app_name)] }}'" "$ENV_FILE"
163173 sd "siteId: '.*'" "siteId: '${{ secrets[format('CUSTOMERIO_{0}_WORKSPACE_SITE_ID', inputs.app_name)] }}'" "$ENV_FILE"
164174 sd "workspaceName: '.*'" "workspaceName: '${{ inputs.cio-workspace-name }}'" "$ENV_FILE"
165- sd "branchName: '.*'" "branchName: '$BRANCH_NAME'" "$ENV_FILE"
166- sd "commitHash: '.*'" "commitHash: '${COMMIT_HASH:0:7 }'" "$ENV_FILE"
175+ sd "branchName: '.*'" "branchName: '${{ env. BRANCH_NAME }} '" "$ENV_FILE"
176+ sd "commitHash: '.*'" "commitHash: '${{ env. COMMIT_HASH } }'" "$ENV_FILE"
167177 LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "untagged")
168178 COMMITS_AHEAD=$(git rev-list $LAST_TAG..HEAD --count 2>/dev/null || echo "untracked")
169179 sd "commitsAheadCount: '.*'" "commitsAheadCount: '$COMMITS_AHEAD'" "$ENV_FILE"
@@ -222,6 +232,23 @@ jobs:
222232 FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT_CREDS_B64 : ${{ secrets.FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT_CREDS_B64 }}
223233 continue-on-error : true # continue to build iOS app even if Android build fails
224234
235+ - name : Send Slack Notification for Sample App Builds (Android)
236+ if : ${{ always() && env.IS_PRIMARY_APP == 'true' }}
237+ uses : customerio/mobile-ci-tools/github-actions/slack-notify-sample-app/v1@main
238+ with :
239+ build_status : ${{ steps.android_build.outcome }}
240+ app_icon_emoji : " :react:"
241+ app_name : " React Native"
242+ firebase_app_id : ${{ secrets[format('SAMPLE_APPS_{0}_FIREBASE_APP_ID_ANDROID', inputs.app_name)] }}
243+ firebase_distribution_groups : ${{ env.firebase_distribution_groups }}
244+ git_context : " ${{ env.BRANCH_NAME }} (${{ env.COMMIT_HASH }})"
245+ icon_url : " https://vectorified.com/images/icon-react-native-24.png"
246+ instructions_guide_link : ${{ secrets.SAMPLE_APPS_INSTRUCTIONS_GUIDE_LINK }}
247+ platform : " android"
248+ sdk_name : " React Native SDK"
249+ sdk_version : ${{ env.SDK_VERSION_NAME }}
250+ slack_webhook_url : ${{ secrets.SLACK_WEBHOOK_URL }}
251+
225252 # iOS setup
226253
227254 - name : Setup iOS environment for sample app
@@ -240,6 +267,23 @@ jobs:
240267 GOOGLE_CLOUD_MATCH_READONLY_SERVICE_ACCOUNT_B64 : ${{ secrets.GOOGLE_CLOUD_MATCH_READONLY_SERVICE_ACCOUNT_B64 }}
241268 FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT_CREDS_B64 : ${{ secrets.FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT_CREDS_B64 }}
242269
270+ - name : Send Slack Notification for Sample App Builds (iOS)
271+ if : ${{ always() && env.IS_PRIMARY_APP == 'true' }}
272+ uses : customerio/mobile-ci-tools/github-actions/slack-notify-sample-app/v1@main
273+ with :
274+ build_status : ${{ steps.ios_build.outcome }}
275+ app_icon_emoji : " :react:"
276+ app_name : " React Native"
277+ firebase_app_id : ${{ secrets[format('SAMPLE_APPS_{0}_FIREBASE_APP_ID_IOS', inputs.app_name)] }}
278+ firebase_distribution_groups : ${{ env.firebase_distribution_groups }}
279+ git_context : " ${{ env.BRANCH_NAME }} (${{ env.COMMIT_HASH }})"
280+ icon_url : " https://vectorified.com/images/icon-react-native-24.png"
281+ instructions_guide_link : ${{ secrets.SAMPLE_APPS_INSTRUCTIONS_GUIDE_LINK }}
282+ platform : " ios"
283+ sdk_name : " React Native SDK"
284+ sdk_version : ${{ env.SDK_VERSION_NAME }}
285+ slack_webhook_url : ${{ secrets.SLACK_WEBHOOK_URL }}
286+
243287 - name : Check build statuses and mark failure
244288 run : |
245289 FAILED_BUILDS=()
0 commit comments