-
Notifications
You must be signed in to change notification settings - Fork 11
132 lines (110 loc) · 5.01 KB
/
build-sample-apps.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Build sample apps
on:
push:
workflow_dispatch: # allow manual run
concurrency: # cancel previous workflow run if one exists.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
XCODE_VERSION: "15.3"
jobs:
build-ios-sample-apps:
runs-on: macos-14
name: Building sample app ${{ matrix.sample-app }}
strategy:
fail-fast: false # if one sample app fails to build, let the other sample apps continue to build and not cancel them.
matrix: # Use a matrix allowing us to build multiple apps in parallel. Just add an entry to the matrix and it will build!
sample-app:
# List all sample apps you want to have compiled.
# List item is name of directory inside of "apps" directory for the corresponding app to compile.
- "amiapp_flutter"
defaults:
run:
working-directory: apps/${{ matrix.sample-app }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-flutter
- name: Install CLI tools used in CI script
shell: bash
run: |
brew install sd # used in CI script as an easier to use sed CLI. Replaces text in files.
brew install xcbeautify # used by fastlane for output
- name: Read Ruby Version
id: read_ruby_version
run: echo "RUBY_VERSION=$(cat .ruby-version)" >> $GITHUB_ENV
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true # cache tools to make builds faster in future
- name: Install Ruby dependencies
run: bundle install
- name: Generate New Version
uses: maierj/[email protected]
with:
subdirectory: apps/${{ matrix.sample-app }}
lane: "generate_new_version"
options: '{"branch_name":"${{ github.ref_name }}", "pull_request_number":"${{ github.event.pull_request.number }}"}'
- name: Update Flutter SDK Version
uses: maierj/[email protected]
with:
subdirectory: apps/${{ matrix.sample-app }}
lane: "update_flutter_sdk_version"
env:
SDK_VERSION_NAME: ${{ env.SDK_VERSION_NAME }}
APP_VERSION_NAME: ${{ env.APP_VERSION_NAME }}
APP_VERSION_CODE: ${{ env.APP_VERSION_CODE }}
- name: Update Sample App Version
uses: maierj/[email protected]
with:
subdirectory: apps/${{ matrix.sample-app }}
lane: "update_flutter_app_version"
env:
SDK_VERSION_NAME: ${{ env.SDK_VERSION_NAME }}
APP_VERSION_NAME: ${{ env.APP_VERSION_NAME }}
APP_VERSION_CODE: ${{ env.APP_VERSION_CODE }}
- name: Install flutter dependencies for SDK
run: cd ../.. && flutter pub get
- name: Install flutter dependencies for sample app
run: flutter pub get
- name: Setup workspace credentials in flutter environment files
run: |
cp ".env.example" ".env"
sd "siteid" "${{ secrets[format('CUSTOMERIO_{0}_WORKSPACE_SITE_ID', matrix.sample-app)] }}" ".env"
sd "apikey" "${{ secrets[format('CUSTOMERIO_{0}_WORKSPACE_API_KEY', matrix.sample-app)] }}" ".env"
- name: Setup workspace credentials in iOS environment files
run: |
cp "ios/Env.swift.example" "ios/Env.swift"
sd "siteid" "${{ secrets[format('CUSTOMERIO_{0}_WORKSPACE_SITE_ID', matrix.sample-app)] }}" "ios/Env.swift"
sd "apiKey" "${{ secrets[format('CUSTOMERIO_{0}_WORKSPACE_API_KEY', matrix.sample-app)] }}" "ios/Env.swift"
- name: Setup Android environment for sample app
uses: ./.github/actions/setup-android
- name: Build and upload Android app via Fastlane
uses: maierj/[email protected]
with:
subdirectory: apps/${{ matrix.sample-app }}
lane: 'android build'
env:
FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT_CREDS_B64: ${{ secrets.FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT_CREDS_B64 }}
- name: Setup iOS environment for sample app
uses: ./.github/actions/setup-ios
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Cache CocoaPods downloaded dependencies for faster builds in the future
uses: actions/cache@v4
with:
path: Pods
key: ${{ runner.os }}-${{ matrix.sample-app }}-Pods-${{ github.ref }}
restore-keys: |
${{ runner.os }}-${{ matrix.sample-app }}-Pods
- name: pod install
run: pod install --project-directory=ios
- name: Build and upload iOS app via Fastlane
uses: maierj/[email protected]
with:
subdirectory: apps/${{ matrix.sample-app }}
lane: "ios build"
options: ${{ inputs.fastlane-build-args }}
env:
GOOGLE_CLOUD_MATCH_READONLY_SERVICE_ACCOUNT_B64: ${{ inputs.GOOGLE_CLOUD_MATCH_READONLY_SERVICE_ACCOUNT_B64 }}
FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT_CREDS_B64: ${{ inputs.FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT_CREDS_B64 }}