@@ -106,19 +106,22 @@ jobs:
106
106
APP_VERSION_NAME : ${{ env.APP_VERSION_NAME }}
107
107
APP_VERSION_CODE : ${{ env.APP_VERSION_CODE }}
108
108
109
+ - name : Set Git Context Variables
110
+ run : |
111
+ echo "BRANCH_NAME=${{ github.head_ref || github.ref_name }}" >> $GITHUB_ENV
112
+ COMMIT_HASH="${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}"
113
+ echo "COMMIT_HASH=${COMMIT_HASH:0:7}" >> $GITHUB_ENV
114
+
109
115
- name : Setup workspace credentials in flutter environment files
110
- env :
111
- BRANCH_NAME : ${{ github.head_ref || github.ref_name }}
112
- COMMIT_HASH : ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
113
116
run : |
114
117
ENV_FILE=".env"
115
118
touch "$ENV_FILE"
116
119
echo "BUILD_TIMESTAMP=$(date +%s)" >> "$ENV_FILE"
117
120
echo "CDP_API_KEY=${{ secrets[format('CUSTOMERIO_{0}_WORKSPACE_CDP_API_KEY', matrix.sample-app.name)] }}" >> "$ENV_FILE"
118
121
echo "SITE_ID=${{ secrets[format('CUSTOMERIO_{0}_WORKSPACE_SITE_ID', matrix.sample-app.name)] }}" >> "$ENV_FILE"
119
122
echo "WORKSPACE_NAME=${{ matrix.sample-app.cio-workspace-name }}" >> "$ENV_FILE"
120
- echo "BRANCH_NAME=$BRANCH_NAME" >> "$ENV_FILE"
121
- echo "COMMIT_HASH=${COMMIT_HASH:0:7 }" >> "$ENV_FILE"
123
+ echo "BRANCH_NAME=${{ env. BRANCH_NAME }} " >> "$ENV_FILE"
124
+ echo "COMMIT_HASH=${{ env. COMMIT_HASH } }" >> "$ENV_FILE"
122
125
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "untagged")
123
126
COMMITS_AHEAD=$(git rev-list $LAST_TAG..HEAD --count 2>/dev/null || echo "untracked")
124
127
echo "COMMITS_AHEAD_COUNT=$COMMITS_AHEAD" >> "$ENV_FILE"
@@ -154,6 +157,23 @@ jobs:
154
157
FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT_CREDS_B64 : ${{ secrets.FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT_CREDS_B64 }}
155
158
continue-on-error : true # continue to build iOS app even if Android build fails
156
159
160
+ - name : Send Slack Notification for Sample App Builds (Android)
161
+ if : always()
162
+ uses : customerio/mobile-ci-tools/github-actions/slack-notify-sample-app/v1
163
+ with :
164
+ build_status : ${{ steps.android_build.outcome }}
165
+ app_icon_emoji : " :flutter:"
166
+ app_name : " Flutter"
167
+ firebase_app_id : ${{ secrets[format('SAMPLE_APPS_{0}_FIREBASE_APP_ID_ANDROID', matrix.sample-app.name)] }}
168
+ firebase_distribution_groups : ${{ env.firebase_distribution_groups }}
169
+ git_context : " ${{ env.BRANCH_NAME }} (${{ env.COMMIT_HASH }})"
170
+ icon_url : " https://img.icons8.com/color/512/flutter.png"
171
+ instructions_guide_link : ${{ secrets.SAMPLE_APPS_INSTRUCTIONS_GUIDE_LINK }}
172
+ platform : " android"
173
+ sdk_name : " Flutter SDK"
174
+ sdk_version : ${{ env.SDK_VERSION_NAME }}
175
+ slack_webhook_url : ${{ secrets.SLACK_WEBHOOK_URL }}
176
+
157
177
build-ios-sample-app :
158
178
strategy :
159
179
fail-fast : false # if one sample app fails to build, let the other sample apps continue to build and not cancel them.
@@ -251,19 +271,22 @@ jobs:
251
271
APP_VERSION_NAME : ${{ env.APP_VERSION_NAME }}
252
272
APP_VERSION_CODE : ${{ env.APP_VERSION_CODE }}
253
273
274
+ - name : Set Git Context Variables
275
+ run : |
276
+ echo "BRANCH_NAME=${{ github.head_ref || github.ref_name }}" >> $GITHUB_ENV
277
+ COMMIT_HASH="${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}"
278
+ echo "COMMIT_HASH=${COMMIT_HASH:0:7}" >> $GITHUB_ENV
279
+
254
280
- name : Setup workspace credentials in flutter environment files
255
- env :
256
- BRANCH_NAME : ${{ github.head_ref || github.ref_name }}
257
- COMMIT_HASH : ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
258
281
run : |
259
282
ENV_FILE=".env"
260
283
touch "$ENV_FILE"
261
284
echo "BUILD_TIMESTAMP=$(date +%s)" >> "$ENV_FILE"
262
285
echo "CDP_API_KEY=${{ secrets[format('CUSTOMERIO_{0}_WORKSPACE_CDP_API_KEY', matrix.sample-app.name)] }}" >> "$ENV_FILE"
263
286
echo "SITE_ID=${{ secrets[format('CUSTOMERIO_{0}_WORKSPACE_SITE_ID', matrix.sample-app.name)] }}" >> "$ENV_FILE"
264
287
echo "WORKSPACE_NAME=${{ matrix.sample-app.cio-workspace-name }}" >> "$ENV_FILE"
265
- echo "BRANCH_NAME=$BRANCH_NAME" >> "$ENV_FILE"
266
- echo "COMMIT_HASH=${COMMIT_HASH:0:7 }" >> "$ENV_FILE"
288
+ echo "BRANCH_NAME=${{ env. BRANCH_NAME }} " >> "$ENV_FILE"
289
+ echo "COMMIT_HASH=${{ env. COMMIT_HASH } }" >> "$ENV_FILE"
267
290
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "untagged")
268
291
COMMITS_AHEAD=$(git rev-list $LAST_TAG..HEAD --count 2>/dev/null || echo "untracked")
269
292
echo "COMMITS_AHEAD_COUNT=$COMMITS_AHEAD" >> "$ENV_FILE"
@@ -315,4 +338,21 @@ jobs:
315
338
options : ' {"distribution_groups": "${{ env.firebase_distribution_groups }}"}'
316
339
env :
317
340
GOOGLE_CLOUD_MATCH_READONLY_SERVICE_ACCOUNT_B64 : ${{ secrets.GOOGLE_CLOUD_MATCH_READONLY_SERVICE_ACCOUNT_B64 }}
318
- FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT_CREDS_B64 : ${{ secrets.FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT_CREDS_B64 }}
341
+ FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT_CREDS_B64 : ${{ secrets.FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT_CREDS_B64 }}
342
+
343
+ - name : Send Slack Notification for Sample App Builds (iOS)
344
+ if : always()
345
+ uses : customerio/mobile-ci-tools/github-actions/slack-notify-sample-app/v1
346
+ with :
347
+ build_status : ${{ steps.ios_build.outcome }}
348
+ app_icon_emoji : " :flutter:"
349
+ app_name : " Flutter"
350
+ firebase_app_id : ${{ secrets[format('SAMPLE_APPS_{0}_FIREBASE_APP_ID_IOS', matrix.sample-app.name)] }}
351
+ firebase_distribution_groups : ${{ env.firebase_distribution_groups }}
352
+ git_context : " ${{ env.BRANCH_NAME }} (${{ env.COMMIT_HASH }})"
353
+ icon_url : " https://img.icons8.com/color/512/flutter.png"
354
+ instructions_guide_link : ${{ secrets.SAMPLE_APPS_INSTRUCTIONS_GUIDE_LINK }}
355
+ platform : " ios"
356
+ sdk_name : " Flutter SDK"
357
+ sdk_version : ${{ env.SDK_VERSION_NAME }}
358
+ slack_webhook_url : ${{ secrets.SLACK_WEBHOOK_URL }}
0 commit comments