@@ -3,9 +3,9 @@ name: CD Android build and distribution
3
3
on :
4
4
push :
5
5
branches :
6
- - main
6
+ - main
7
7
tags :
8
- - ' *'
8
+ - ' *'
9
9
10
10
jobs :
11
11
Android-App-Build :
27
27
path : ~/.gradle/wrapper
28
28
key : ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
29
29
30
- - name : create google-services.json
31
- env :
32
- GOOGLE_SERVICES : ${{secrets.GOOGLE_SERVICES_ANDROID}}
33
- run : |
34
- echo $GOOGLE_SERVICES >> ./examples/mobile/android/app/google-services.json
35
- ls ./examples/mobile/android/app/
36
-
37
- - name : update gradle plugins for google services
38
- run : |
39
- echo 'apply plugin: "com.google.gms.google-services"' >> examples/mobile/android/app/plugins.gradle
40
-
41
30
- name : Install the signing certificate
42
31
env :
43
32
DISTRIBUTION_CERTIFICATE_ANDROID_BASE64 : ${{ secrets.RELEASE_KEYSTORE_BASE64 }}
55
44
- name : calculate version
56
45
run : |
57
46
versionName='1.0.'$GITHUB_RUN_NUMBER
58
- versionCode=$(($ GITHUB_RUN_NUMBER+33)) ; echo "versionName: $versionName; versionCode: $versionCode"
47
+ versionCode=$GITHUB_RUN_NUMBER; echo "versionName: $versionName; versionCode: $versionCode"
59
48
echo "export VERSION_NAME=$versionName; export VERSION_CODE=$versionCode" > ~/.env_version
60
49
61
50
- name : Beta Android App Build
77
66
path : |
78
67
./examples/mobile/android/app/build/outputs/bundle/release/app-release.aab
79
68
69
+ Android-Firebase-Distribution :
70
+ needs : Android-App-Build
71
+ runs-on : ubuntu-latest
72
+ steps :
73
+ - name : Checkout source code
74
+ uses : actions/checkout@v3
75
+ - uses : actions/setup-node@master
76
+ - name : Install modules
77
+ run : yarn install
78
+ - name : Set up JDK 11
79
+ uses : actions/setup-java@v3
80
+ with :
81
+ distribution : " zulu"
82
+ java-version : 11
83
+ - name : Cache Gradle Wrapper
84
+ uses : actions/cache@v3
85
+ with :
86
+ path : ~/.gradle/wrapper
87
+ key : ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
88
+
89
+ - name : Download release artifacts
90
+ uses : actions/download-artifact@v3
91
+ with :
92
+ name : android-release-apk
93
+ path : ./examples/mobile/android/app/build/outputs/apk/release
94
+
95
+ - name : ' Export Firebase App Id and Credentials'
96
+ env :
97
+ FIREBASE_APP_ID_ANDROID : ${{secrets.FIREBASE_APP_ID_ANDROID}}
98
+ GOOGLE_APPLICATION_CREDENTIALS_KEY : ${{secrets.GOOGLE_APPLICATION_CREDENTIALS}}
99
+ run : |
100
+ echo $GOOGLE_APPLICATION_CREDENTIALS_KEY >> $GITHUB_WORKSPACE/google-app-creds.json
101
+ echo "export FIREBASE_APP_ID=$FIREBASE_APP_ID_ANDROID; export GOOGLE_APPLICATION_CREDENTIALS=$GITHUB_WORKSPACE/google-app-creds.json" > ~/.env_creds
102
+
103
+ - name : calculate version
104
+ run : |
105
+ versionName='1.0.'$GITHUB_RUN_NUMBER
106
+ versionCode=$GITHUB_RUN_NUMBER;
107
+ echo "export VERSION_NAME=$versionName; export VERSION_CODE=$versionCode" > ~/.env_version
108
+
109
+ - name : create google-services.json
110
+ env :
111
+ GOOGLE_SERVICES : ${{secrets.GOOGLE_SERVICES_ANDROID}}
112
+ run : |
113
+ echo $GOOGLE_SERVICES >> ./examples/mobile/android/app/google-services.json
114
+
115
+ - name : Deploy to Firebase
116
+ run : |
117
+ source ~/.env_version
118
+ source ~/.env_creds
119
+ cd examples/mobile/android && gradle appDistributionUploadRelease --stacktrace
120
+
80
121
Android-Play-Store-Distribution :
81
122
if : github.event_name == 'push' && contains(github.ref, 'refs/tags/')
82
123
needs : Android-App-Build
0 commit comments