Skip to content

Commit

Permalink
ci: add Android Build github action
Browse files Browse the repository at this point in the history
  • Loading branch information
xianshenglu committed Apr 29, 2022
1 parent 785e2fb commit 6aa45f8
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/android_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Android Build ## name of the workflow

on:
push:
branches:
- main

jobs:
android-build:
name: Android Build
runs-on: ubuntu-latest # using ubuntu latest version / or you can use a specific version

steps:
- name: Check out Git repository # clone the repo to local ci workspace
uses: actions/checkout@v2

- name: Set up our JDK environment # setup JDK environment: mandatory as we need to build android project
uses: actions/[email protected]
with:
java-version: 1.8

- name: Install dependencies
run: npm ci

# configure cash for gradle : will help to reduce build time
- name: Cache Gradle Wrapper
uses: actions/cache@v2
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}

- name: Cache Gradle Dependencies
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-caches-
- name: Make Gradlew Executable
run: cd android && chmod +x ./gradlew

- name: Generate App APK
run: |
cd android && ./gradlew assembleRelease --no-daemon
## sign generated apk
- name: Sign APK
id: sign_app
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: android/app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.MYAPP_UPLOAD_STORE_FILE_BASE64 }}
alias: ${{ secrets.MYAPP_UPLOAD_KEY_ALIAS }}
keyStorePassword: ${{ secrets.MYAPP_UPLOAD_STORE_PASSWORD }}
keyPassword: ${{ secrets.MYAPP_UPLOAD_KEY_PASSWORD }}

- name: Changelog
run: |
git config --local user.email "[email protected]"
git config --local user.name "xianshenglu"
npm run changelog
git push --follow-tags
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{steps.sign_app.outputs.signedReleaseFile}}



## Distribute app to Firebase App Distribution for testing / use google play internal track if you have a google play account
# - name: upload artifact to Firebase App Distribution
# uses: wzieba/Firebase-Distribution-Github-Action@v1
# with:
# appId: ${{secrets.ANDROID_FIREBASE_APP_ID}}
# token: ${{secrets.ANDROID_FIREBASE_TOKEN}}
# groups: testers
# file: ${{steps.sign_app.outputs.signedReleaseFile}}

0 comments on commit 6aa45f8

Please sign in to comment.