Skip to content

firebase-app-dist

firebase-app-dist #297

name: Android Development Distribution and Maestro
on:
workflow_dispatch:
repository_dispatch:
types: [firebase-app-dist]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
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@v3
with:
repository: lingopractices/mobile
token: ${{ secrets.MOBILE_PAT }}
- name: Set up our JDK environment # setup JDK environment: mandatory as we need to build android project
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "YARN_CACHE_DIR=$(yarn cache dir)" >> $GITHUB_ENV
- name: Cache Yarn dependencies
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ env.YARN_CACHE_DIR }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies # install project deps with --frozen-lockfile to make sure we will have the same packages version ( very recommended on running yarn install on ci)
run: yarn install --frozen-lockfile
## configure cash for gradle : will help to reduce build time
- name: Cache Gradle Wrapper
uses: actions/cache@v3
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Cache Gradle Dependencies
uses: actions/cache@v3
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: Inject slug/short variables
uses: rlespinasse/github-slug-action@v3.x
- name: Define vars
id: vars # Needed to reuse at 'with: steps.vars.outputs'
shell: bash
run: |
# extract version from package.json
echo "TAG=$(node -p 'require("./package.json").version')" >> $GITHUB_ENV
- name: Generating config files
run: yarn rnuc .env.staging
- name: Generate App APK
env:
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
ENV: staging
BUNDLE_ID: com.lingopractices.dev
APP_VERSION: ${{ env.TAG }}
id: generate_apk
run: cd android && ./gradlew assembleRelease --no-daemon
## 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}}
serviceCredentialsFileContent: ${{ secrets.ANDROID_FIREBASE_CREDENTIALS }}
groups: testers
file: android/app/build/outputs/apk/release/app-release.apk
- name: Rename APK
run: mv ./android/app/build/outputs/apk/release/app-release.apk ./android/app/build/outputs/apk/release/LingoPractices.apk
## Release APK in the releases folder in the GitHub
- name: Release signed APK
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.MOBILE_PAT }}
tag_name: ${{ env.TAG }}
files: android/app/build/outputs/apk/release/LingoPractices.apk
repository: lingopractices/mobile
## Send APK to the Maestro Cloud for automated testing
- name: Test APK with Maestro Cloud
uses: mobile-dev-inc/action-maestro-cloud@v1
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: android/app/build/outputs/apk/release/LingoPractices.apk
async: true
name: ${{ env.TAG }}