play-market-release-dist #76
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Android Release Distribution | |
| on: | |
| workflow_dispatch: | |
| repository_dispatch: | |
| types: [play-market-release-dist] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| android-build: | |
| name: Android Release 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 }} | |
| ref: 'main' | |
| - 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: Install Ruby 2.x | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '2.7.6' | |
| bundler-cache: true | |
| working-directory: android | |
| - name: Inject slug/short variables | |
| uses: rlespinasse/github-slug-action@v3.x | |
| - name: Generating config files | |
| run: yarn rnuc .env.production | |
| - name: Run Fastlane build | |
| working-directory: android | |
| run: bundle exec fastlane deploy | |
| env: | |
| PLAY_MARKET_API_PRIVATE_KEY: ${{ secrets.PLAY_MARKET_API_PRIVATE_KEY }} | |
| SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
| ENV: production | |
| BUNDLE_ID: com.lingopractices | |
| CI: true |