From 889395b84ffa86c15c6c97994ae0a07fc681618e Mon Sep 17 00:00:00 2001 From: Arafat Zahan Date: Sun, 22 May 2022 00:34:16 +0600 Subject: [PATCH] chore(infra): add github action for android build. --- .github/workflows/android.yml | 85 +++++++++++++++++++++++++++++++++++ .github/workflows/lint.yml | 6 ++- 2 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/android.yml diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 0000000..d7e0fce --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,85 @@ +name: Android Build + +on: + push: + branches: + - master + paths: + - ".github/workflows/lint.yml" + - "**.js" + - "**.json" + - "**.ts" + - "**.tsx" + - "template/.eslint*" + - "template/.prettier*" + - "template/package.json" + - "template/tsconfig.json" + - "template/yarn.lock" + - "template/android/**" + pull_request: + branches: + - master + paths: + - ".github/workflows/lint.yml" + - "**.js" + - "**.json" + - "**.ts" + - "**.tsx" + - "template/.eslint*" + - "template/.prettier*" + - "template/package.json" + - "template/tsconfig.json" + - "template/yarn.lock" + - "template/android/**" + types: + - opened + - reopened + - synchronize + +concurrency: + group: android-${{ github.ref }} + cancel-in-progress: true + +jobs: + lint: + name: Android Build + runs-on: ubuntu-latest + timeout-minutes: 20 + defaults: + run: + working-directory: template + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version-file: "template/.nvmrc" + cache: "yarn" + cache-dependency-path: template/yarn.lock + - name: Setup JDK 11 + uses: actions/setup-java@v3 + with: + distribution: "zulu" + java-version: "11" + - 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: Install dependencies + run: yarn + - name: Android Release Build + run: cd android && ./gradlew assembleRelease --no-daemon + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: helloworld-app-release.apk + path: template/android/app/build/outputs/apk/release/app-release.apk diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1b9a59d..0994d93 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -47,8 +47,10 @@ jobs: run: working-directory: template steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Node + uses: actions/setup-node@v3 with: node-version-file: "template/.nvmrc" cache: "yarn"