Skip to content

Commit ea172d0

Browse files
authored
Merge pull request #276 from Resgrid/develop
RG-T132 Build fix
2 parents e8521dc + d78eb65 commit ea172d0

2 files changed

Lines changed: 38 additions & 5 deletions

File tree

.github/workflows/react-native-cicd.yml

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,35 @@ jobs:
193193
- name: 📋 Create Google Json File
194194
if: ${{ matrix.platform == 'android' }}
195195
run: |
196-
echo $UNIT_GOOGLE_SERVICES | base64 -d > google-services.json
196+
printf '%s' "$UNIT_GOOGLE_SERVICES" | base64 -d > google-services.json
197+
198+
# Keystore is decoded OUTSIDE the project root so it can never be picked up
199+
# by the EAS build archive or any artifact globs; credentials.json points to
200+
# it via an absolute path (supported by EAS for local credentials).
201+
- name: 📋 Create Android Keystore
202+
if: ${{ matrix.platform == 'android' }}
203+
run: |
204+
printf '%s' "$UNIT_ANDROID_KS" | base64 -d > "$RUNNER_TEMP/keystore.jks"
205+
chmod 600 "$RUNNER_TEMP/keystore.jks"
206+
207+
- name: 📋 Ensure jq exists
208+
if: ${{ matrix.platform == 'android' }}
209+
run: |
210+
if ! command -v jq >/dev/null 2>&1; then
211+
echo "Installing jq..."
212+
sudo apt-get update && sudo apt-get install -y jq
213+
fi
214+
215+
- name: 📋 Create Credentials File
216+
if: ${{ matrix.platform == 'android' }}
217+
run: |
218+
printf '%s' "$CREDENTIALS_JSON_BASE64" | base64 -d \
219+
| jq --arg ks "$RUNNER_TEMP/keystore.jks" '.android.keystore.keystorePath = $ks' > credentials.json
197220
198221
- name: 📋 Create Google Json File for iOS
199222
if: ${{ matrix.platform == 'ios' }}
200223
run: |
201-
echo $UNIT_IOS_GOOGLE_SERVICES | base64 -d > GoogleService-Info.plist
224+
printf '%s' "$UNIT_IOS_GOOGLE_SERVICES" | base64 -d > GoogleService-Info.plist
202225
203226
- name: 📋 Update package.json Versions
204227
run: |
@@ -243,16 +266,17 @@ jobs:
243266
eas --version
244267
245268
- name: 📋 Create iOS Cert
269+
if: ${{ matrix.platform == 'ios' }}
246270
run: |
247-
echo $UNIT_IOS_CERT | base64 -d > AuthKey_HRBP5FNJN6.p8
271+
printf '%s' "$UNIT_IOS_CERT" | base64 -d > AuthKey_HRBP5FNJN6.p8
248272
249273
- name: 📋 Restore gradle.properties
250274
env:
251275
GRADLE_PROPERTIES: ${{ secrets.GRADLE_PROPERTIES }}
252276
shell: bash
253277
run: |
254278
mkdir -p ~/.gradle/
255-
echo ${GRADLE_PROPERTIES} > ~/.gradle/gradle.properties
279+
printf '%s\n' "$GRADLE_PROPERTIES" > ~/.gradle/gradle.properties
256280
257281
- name: 📱 Build Development APK
258282
if: (matrix.platform == 'android' && (github.event.inputs.buildType == 'all' || github.event_name == 'push' || github.event.inputs.buildType == 'dev'))
@@ -275,7 +299,7 @@ jobs:
275299
if: (matrix.platform == 'android' && (github.event.inputs.buildType == 'all' || github.event_name == 'push' || github.event.inputs.buildType == 'prod-aab'))
276300
run: |
277301
export NODE_OPTIONS="--openssl-legacy-provider --max_old_space_size=4096"
278-
eas build --platform android --profile production --local --non-interactive --output=./ResgridUnit-prod.aab
302+
eas build --platform android --profile production-aab --local --non-interactive --output=./ResgridUnit-prod.aab
279303
env:
280304
NODE_ENV: production
281305

@@ -303,6 +327,10 @@ jobs:
303327
env:
304328
NODE_ENV: production
305329

330+
- name: 🧹 Remove signing materials
331+
if: always()
332+
run: rm -f credentials.json AuthKey_HRBP5FNJN6.p8 "$RUNNER_TEMP/keystore.jks" ~/.gradle/gradle.properties
333+
306334
- name: 📦 Upload build artifacts to GitHub
307335
uses: actions/upload-artifact@v4
308336
with:

eas.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@
1919
"FLIPPER_DISABLE": "1"
2020
}
2121
},
22+
"production-aab": {
23+
"extends": "production",
24+
"credentialsSource": "local"
25+
},
2226
"production-apk": {
2327
"distribution": "store",
28+
"credentialsSource": "local",
2429
"yarn": "1.22.22",
2530
"ios": {
2631
"image": "latest"

0 commit comments

Comments
 (0)