1+ name : Build Android
2+
3+ on :
4+ workflow_call :
5+ inputs :
6+ type :
7+ type : string
8+ required : true
9+ secrets :
10+ BUGSNAG_KEY :
11+ required : true
12+ KEYSTORE_EXPERIMENTAL :
13+ required : true
14+ KEYSTORE_EXPERIMENTAL_BASE64 :
15+ required : true
16+ KEYSTORE_EXPERIMENTAL_PASSWORD :
17+ required : true
18+ KEYSTORE_EXPERIMENTAL_ALIAS :
19+ required : true
20+ GOOGLE_SERVICES_ANDROID :
21+ required : true
22+ FASTLANE_GOOGLE_SERVICE_ACCOUNT :
23+ required : true
24+
25+ jobs :
26+ build-android :
27+ runs-on : ubuntu-latest
28+ steps :
29+ - name : Checkout Repository
30+ uses : actions/checkout@v4
31+
32+ - name : Log the secrets
33+ run : |
34+ if [ -z "${{ secrets.KEYSTORE_EXPERIMENTAL_BASE64 }}" ]; then
35+ echo "❌ KEYSTORE_EXPERIMENTAL_BASE64 is NOT set"
36+ else
37+ echo "✅ KEYSTORE_EXPERIMENTAL_BASE64 is set"
38+ fi
39+
40+ if [ -z "${{ secrets.KEYSTORE_EXPERIMENTAL_PASSWORD }}" ]; then
41+ echo "❌ KEYSTORE_EXPERIMENTAL_PASSWORD is NOT set"
42+ else
43+ echo "✅ KEYSTORE_EXPERIMENTAL_PASSWORD is set"
44+ fi
45+
46+ if [ -z "${{ secrets.KEYSTORE_EXPERIMENTAL_ALIAS }}" ]; then
47+ echo "❌ KEYSTORE_EXPERIMENTAL_ALIAS is NOT set"
48+ else
49+ echo "✅ KEYSTORE_EXPERIMENTAL_ALIAS is set"
50+ fi
51+
52+ - name : Set up Node.js
53+ uses : actions/setup-node@v4
54+ with :
55+ node-version : 22
56+ cache : ' yarn'
57+
58+ - name : Decode Keystore
59+ run : |
60+ echo "${{ secrets.KEYSTORE_EXPERIMENTAL_BASE64 }}" | base64 -d > android/app/${{ secrets.KEYSTORE_EXPERIMENTAL }}
61+
62+ - name : Set gradle.properties
63+ run : |
64+ echo " " >> android/gradle.properties
65+ echo -e "android.useAndroidX=true" >> android/gradle.properties
66+ echo -e "android.enableJetifier=true" >> android/gradle.properties
67+ echo -e "reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64" >> android/gradle.properties
68+ echo -e "newArchEnabled=false" >> android/gradle.properties
69+ echo -e "hermesEnabled=true" >> android/gradle.properties
70+ echo -e "VERSIONCODE=$GITHUB_RUN_NUMBER" >> ./gradle.properties
71+
72+ if [[ ${{ inputs.type }} == "experimental" ]]; then
73+ echo -e "APPLICATION_ID=chat.rocket.reactnative" >> android/gradle.properties
74+ echo -e "BugsnagAPIKey=${{ secrets.BUGSNAG_KEY }}" >> android/gradle.properties
75+ echo -e "KEYSTORE=${{ secrets.KEYSTORE_EXPERIMENTAL }}" >> android/gradle.properties
76+ echo -e "KEYSTORE_PASSWORD=${{ secrets.KEYSTORE_EXPERIMENTAL_PASSWORD }}" >> android/gradle.properties
77+ echo -e "KEY_ALIAS=${{ secrets.KEYSTORE_EXPERIMENTAL_ALIAS }}" >> android/gradle.properties
78+ echo -e "KEY_PASSWORD=${{ secrets.KEYSTORE_EXPERIMENTAL_PASSWORD }}" >> android/gradle.properties
79+ fi
80+
81+ - name : Set Google Services
82+ run : |
83+ if [[ ${{ secrets.GOOGLE_SERVICES_ANDROID }} ]]; then
84+ echo ${{ secrets.GOOGLE_SERVICES_ANDROID }} | base64 --decode > android/app/google-services.json
85+ fi
86+
87+ - name : Install Dependencies
88+ run : yarn install
89+
90+ - name : Set up Gradle
91+ uses : gradle/actions/setup-gradle@v4
92+
93+ - name : Cache Gradle Caches
94+ uses : actions/cache@v4
95+ with :
96+ path : |
97+ ~/.gradle/caches
98+ ~/.gradle/wrapper
99+ key : gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
100+ restore-keys : |
101+ gradle-${{ runner.os }}-
102+
103+ - name : Build Android Release APK
104+ run : |
105+ cd android
106+ ./gradlew bundleExperimentalRelease
107+
108+ - name : Upload sourcemaps/NDK symbols to Bugsnag
109+ run : |
110+ yarn bugsnag:upload-android --variant experimentalRelease --app-manifest android/app/build/intermediates/merged_manifests/experimentalRelease/processExperimentalReleaseManifest/AndroidManifest.xml
111+ yarn bugsnag-cli upload android-aab android/app/build/outputs/bundle/experimentalRelease/app-experimental-release.aab
112+
113+ - name : Store the google service account key
114+ run : |
115+ cd android
116+ echo "${{ secrets.FASTLANE_GOOGLE_SERVICE_ACCOUNT}}" | base64 --decode > service_account.json
117+
118+ - name : Fastlane Play Store Upload
119+ run : |
120+ cd android
121+ bundle exec fastlane android internal_app_sharing
122+
123+ - name : Upload APK
124+ uses : actions/upload-artifact@v4
125+ with :
126+ name : Android Output
127+ path : android/app/build/outputs
0 commit comments