1+ name : Android Build # # name of the workflow
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+
8+ jobs :
9+ android-build :
10+ name : Android Build
11+ runs-on : ubuntu-latest # using ubuntu latest version / or you can use a specific version
12+
13+ steps :
14+ - name : Check out Git repository # clone the repo to local ci workspace
15+ uses : actions/checkout@v2
16+
17+ - name : Set up our JDK environment # setup JDK environment: mandatory as we need to build android project
18+ uses : actions/setup-java@v1.4.3
19+ with :
20+ java-version : 1.8
21+
22+ - name : Install dependencies
23+ run : npm ci
24+
25+ # configure cash for gradle : will help to reduce build time
26+ - name : Cache Gradle Wrapper
27+ uses : actions/cache@v2
28+ with :
29+ path : ~/.gradle/wrapper
30+ key : ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
31+
32+ - name : Cache Gradle Dependencies
33+ uses : actions/cache@v2
34+ with :
35+ path : ~/.gradle/caches
36+ key : ${{ runner.os }}-gradle-caches-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
37+ restore-keys : |
38+ ${{ runner.os }}-gradle-caches-
39+ - name : Make Gradlew Executable
40+ run : cd android && chmod +x ./gradlew
41+
42+ - name : Generate App APK
43+ run : |
44+ cd android && ./gradlew assembleRelease --no-daemon
45+
46+ # # sign generated apk
47+ - name : Sign APK
48+ id : sign_app
49+ uses : r0adkll/sign-android-release@v1
50+ with :
51+ releaseDirectory : android/app/build/outputs/apk/release
52+ signingKeyBase64 : ${{ secrets.MYAPP_UPLOAD_STORE_FILE_BASE64 }}
53+ alias : ${{ secrets.MYAPP_UPLOAD_KEY_ALIAS }}
54+ keyStorePassword : ${{ secrets.MYAPP_UPLOAD_STORE_PASSWORD }}
55+ keyPassword : ${{ secrets.MYAPP_UPLOAD_KEY_PASSWORD }}
56+
57+ - name : Changelog
58+ run : |
59+ git config --local user.email "xianshenglu@qq.com"
60+ git config --local user.name "xianshenglu"
61+ npm run changelog
62+ git push --follow-tags
63+
64+ - name : Release
65+ uses : softprops/action-gh-release@v1
66+ if : startsWith(github.ref, 'refs/tags/')
67+ with :
68+ files : ${{steps.sign_app.outputs.signedReleaseFile}}
69+
70+
71+
72+ # # Distribute app to Firebase App Distribution for testing / use google play internal track if you have a google play account
73+ # - name: upload artifact to Firebase App Distribution
74+ # uses: wzieba/Firebase-Distribution-Github-Action@v1
75+ # with:
76+ # appId: ${{secrets.ANDROID_FIREBASE_APP_ID}}
77+ # token: ${{secrets.ANDROID_FIREBASE_TOKEN}}
78+ # groups: testers
79+ # file: ${{steps.sign_app.outputs.signedReleaseFile}}
0 commit comments