Blog Infos
Author
Published
Topics
,
Published

Lets build some Pipelines.

 

https://unsplash.com/photos/9AxFJaNySB8

 

CI/CD for Android Devs II | GitHub Actions Masterclass

name: Build, test, and deploy Android app
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 1.8
- run: ./gradlew build
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 1.8
- run: ./gradlew test
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 1.8
- run: ./gradlew deploy
- name: Upload APK
uses: actions/upload-artifact@v1
with:
name: app-debug.apk
path: app/build/outputs/apk/debug/app-debug.apk
Github Secrets:

 

 

2. In the left menu, click on the “Secrets” option.

 

 

 

 

${{ secrets.SECRET_NAME }}

Job Offers

Job Offers

There are currently no vacancies.

OUR VIDEO RECOMMENDATION

,

From Chaos to Consistency: Managing Build and Release for 25+ Android Repos with Github Actions

Managing the build and release process for over 25 Android repositories can be a daunting task. With each repository having its own pipeline or workflow, it can become difficult to ensure consistency and quality across…
Watch Video

From Chaos to Consistency: Managing Build and Release for 25+ Android Repos with Github Actions

Shrikant Ballal
Staff Engineer
YML

From Chaos to Consistency: Managing Build and Release for 25+ Android Repos with Github Actions

Shrikant Ballal
Staff Engineer
YML

From Chaos to Consistency: Managing Build and Release for 25+ Android Repos with Github Actions

Shrikant Ballal
Staff Engineer
YML

Jobs

Automating Firebase App Distribution:
#upload qa flavour  apk to firebase app tester using github actions
name: Firebase App Tester QA
on:
  push:
    branches:
      - "QA"
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-java@v1
        with:
          java-version: 11
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - name: Build QA Flavour APK
        run: ./gradlew assembleQaDebug
      - name: Upload QA Flavour APK to Firebase App Tester
        uses: wzieba/Firebase-Distribution-Github-Action@v1
        with:
          appId: ${{ secrets.QA_APP_ID }}
          serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }}
          groups: qa-internal
          releaseNotes: ${{ github.event.head_commit.message }}
          file: app/build/outputs/apk/qa/debug/app-qa-debug.apk
- uses: actions/checkout@v2

2. The second step uses the actions/setup-java action to set up Java on the virtual machine. This is necessary because the Android app is built using Gradle, which requires Java. The java-version key specifies the version of Java to install, which is set to 11 in this example.

- uses: actions/setup-java@v1
  with:
    java-version: 11
- uses: actions/cache@v2
  with:
    path: ~/.gradle/caches
    key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
    restore-keys: |
      ${{ runner.os }}-gradle-
- name: Build QA Flavour APK
  run: ./gradlew assembleQaDebug
- name: Upload QA Flavour APK to Firebase App Tester
  uses: wzieba/Firebase-Distribution-Github-Action@v1
  with:
    appId: ${{ secrets.QA_APP_ID }}
    serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }}
    groups: qa-internal
    releaseNotes: ${{ github.event.head_commit.message }}
    file: app/build/outputs/apk/qa/debug/app-qa-debug.apk

Another example:

name: Upload App Bundle to Play Store
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-java@v1
        with:
          java-version: 1.8
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - name: Build App Bundle
        run: ./gradlew bundleRelease
      - name: Upload App Bundle to Play Store
        uses: r0adkll/upload-google-play@v2
        with:
          package-name: com.example.app
          release-status: completed
          service-account-json: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT }}
          track: production
          app-bundle: app/build/outputs/bundle/release/app-release.aab
          release-notes-file: release-notes.txt

This article was originally published on proandroiddev.com on December 12, 2022

YOU MAY BE INTERESTED IN

YOU MAY BE INTERESTED IN

blog
Life is hard. We are engulfed in tasks that take time, are boring, and…
READ MORE
blog
A common thing for a mobile project is to present the look of the…
READ MORE
blog
As a developer working on various Kotlin Multiplatform projects, whether for your job or…
READ MORE
blog
There are a lot of blogs and videos on why we need CI/CD. From…
READ MORE
Menu