@@ -82,13 +82,53 @@ jobs:
82
82
run : |
83
83
test -e mobile/src/main/jniLibs/x86_64/libaw_server.so
84
84
85
+ # This needs to be a seperate job since fastlane update_version,
86
+ # fails if run concurrently (such as in build apk/aab matrix),
87
+ # thus we need to run it once and and reuse the results.
88
+ # https://github.com/fastlane/fastlane/issues/13689#issuecomment-439217502
89
+ get-versionCode :
90
+ name : Get latest versionCode
91
+ runs-on : ubuntu-latest
92
+ outputs :
93
+ versionCode : ${{ steps.versionCode.outputs.versionCode }}
94
+
95
+ steps :
96
+ - uses : actions/checkout@v2
97
+ with :
98
+ submodules : ' recursive'
99
+
100
+
101
+ # Ruby & Fastlane
102
+ # version set by .ruby-version
103
+ - name : Set up Ruby and install fastlane
104
+ uses : ruby/setup-ruby@v1
105
+ with :
106
+ bundler-cache : true
107
+
108
+ # Needed for `fastlane update_version`
109
+
110
+ - name : Load Fastlane secrets
111
+ env :
112
+ KEY_FASTLANE_API : ${{ secrets.KEY_FASTLANE_API }}
113
+ run : |
114
+ printf "$KEY_FASTLANE_API" > fastlane/api-8546008605074111507-287154-450dc77b365f.json.key
115
+ cat fastlane/api-8546008605074111507-287154-450dc77b365f.json.age \
116
+ | age -d -i fastlane/api-8546008605074111507-287154-450dc77b365f.json.key \
117
+ -o fastlane/api-8546008605074111507-287154-450dc77b365f.json
118
+ rm fastlane/api-8546008605074111507-287154-450dc77b365f.json.key
119
+
120
+ - name : Update versionCode
121
+ run : bundle exec fastlane update_version
122
+
123
+ - name : Output versionCode
124
+ id : versionCode
125
+ run : |
126
+ cat mobile/build.gradle | grep versionCode | sed 's/.*\s\([0-9]*\)$/versionCode=\1/' >> "$GITHUB_OUTPUT"
85
127
86
128
build-apk :
87
129
name : Build ${{ matrix.type }}
88
130
runs-on : ubuntu-20.04
89
- needs : [build-rust]
90
- env :
91
- SUPPLY_TRACK : production # used by fastlane to determine track to publish to
131
+ needs : [build-rust, get-versionCode]
92
132
strategy :
93
133
fail-fast : true
94
134
matrix :
@@ -108,19 +148,11 @@ jobs:
108
148
run : |
109
149
echo "${{ steps.version.outputs.full }} (stable: ${{ steps.version.outputs.is_stable }})"
110
150
111
- - name : Set RELEASE and SUPPLY_TRACK
151
+ - name : Set RELEASE
112
152
run : |
113
153
# Build in release mode if on a tag/release (longer build times)
114
154
echo "RELEASE=${{ startsWith(github.ref_name, 'v') }}" >> $GITHUB_ENV
115
155
116
- # Set SUPPLY_TRACK (used by fastlane) depending on is_stable
117
- if [[ "${{ steps.version.outputs.is_stable }}" == "true" ]]; then
118
- SUPPLY_TRACK="production"
119
- else
120
- SUPPLY_TRACK="internal"
121
- fi
122
- echo "SUPPLY_TRACK=${SUPPLY_TRACK}" >> $GITHUB_ENV
123
-
124
156
- name : Set up JDK
125
157
uses : actions/setup-java@v1
126
158
with :
@@ -136,16 +168,6 @@ jobs:
136
168
ls $ANDROID_NDK_HOME
137
169
echo "ANDROID_NDK_HOME=$ANDROID_NDK_HOME" >> $GITHUB_ENV
138
170
139
- # Ruby & Fastlane
140
- # version set by .ruby-version
141
- - name : Set up Ruby and install fastlane
142
- uses : ruby/setup-ruby@v1
143
- with :
144
- bundler-cache : true
145
-
146
- - name : Install age
147
-
148
-
149
171
# Restores jniLibs from cache
150
172
# `actions/cache/restore` only restores, without saving back in a post-hook
151
173
- uses : actions/cache/restore@v3
@@ -161,28 +183,21 @@ jobs:
161
183
run : |
162
184
test -e mobile/src/main/jniLibs/x86_64/libaw_server.so
163
185
164
- # Needed for `fastlane update_version`
165
- - name : Load Fastlane secrets
166
- env :
167
- KEY_FASTLANE_API : ${{ secrets.KEY_FASTLANE_API }}
168
- run : |
169
- printf "$KEY_FASTLANE_API" > fastlane/api-8546008605074111507-287154-450dc77b365f.json.key
170
- cat fastlane/api-8546008605074111507-287154-450dc77b365f.json.age \
171
- | age -d -i fastlane/api-8546008605074111507-287154-450dc77b365f.json.key \
172
- -o fastlane/api-8546008605074111507-287154-450dc77b365f.json
173
- rm fastlane/api-8546008605074111507-287154-450dc77b365f.json.key
174
-
175
- - name : Set version
186
+ - name : Set versionName
176
187
if : startsWith(github.ref, 'refs/tags/v') # only on runs triggered from tag
177
188
run : |
178
189
# Sets versionName, tail used to skip "v" at start of tag name
179
190
SHORT_VERSION=$(echo "${{ github.ref_name }}" | tail -c +2 -)
180
191
sed -i "s/versionName \".*\"/versionName \"$SHORT_VERSION\"/g" \
181
192
mobile/build.gradle
182
193
183
- - name : Update versionCode
184
- run : bundle exec fastlane update_version
194
+ - name : Set versionCode
195
+ run : |
196
+ # Sets versionCode
197
+ sed -i "s/versionCode .*/versionCode ${{needs.get-versionCode.outputs.versionCode}}" \
198
+ mobile/build.gradle
185
199
200
+
186
201
- name : Load Android secrets
187
202
if : env.KEY_ANDROID_JKS != null
188
203
env :
@@ -496,7 +511,7 @@ jobs:
496
511
echo "SUPPLY_TRACK=${SUPPLY_TRACK}" >> $GITHUB_ENV
497
512
498
513
499
- - name : Load secrets
514
+ - name : Load Android secrets
500
515
env :
501
516
KEY_FASTLANE_API : ${{ secrets.KEY_FASTLANE_API }}
502
517
run : |
0 commit comments