Blog Infos
Author
Published
Topics
,
Published
Posted by: Tarek Ben Driss

And here we are in Part 2. (if you missed the first part, click here)

So, in the first article we prepared our Oreo (the APK file) automatically after pushing the code to GitHub, and we are ready now to deliver it to testers so they can taste/test it ?

First of all, let’s create an account in Firebase and create a new project :

Steps are simple, writing the project name and then click “next” till the final step.

Then, let’s follow Google’s documentation for adding Firebase to your android project, all is here, you can start from “step 3”.

After adding Firebase to your project, wait and refresh the Firebase Console and then click on “App Distribution” -> “Testers and groups” -> “Add group” … Name it “testers” and then, add your email as well as any other person that you want him to get your Oreo.

We also need to install Firebase CLI via this link. Or you can paste this command on your terminal if you are using macOS or Linux :

curl -sL https://firebase.tools | bash

Once the installation is complete, type this command on your cli :

firebase login:ci

You’ll be invited to signin with your gmail and authorize FirebaseCLI to access your Google account. Finally, you’ll receive on your cli something like this :

The token (highlighted in yellow) is important for the next steps, please keep it apart.

Now let’s get the app ID, go back to our project in the Firebase console, and click on Project settings.

Scroll down till you find the App ID:

Now, we are ready to continue our mission, so let’s get back to our android.yml file, before the APK: part, we add this code:

build:
name: Upload apk to App Tester
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: build release
run: bash ./gradlew assembleDebug
- name: upload artifact to Firebase App Distribution
uses: wzieba/Firebase-Distribution-Github-Action@v1.2.2
with:
appId: '1:994326970928:android:2ki953237460aib8a4341c'
token: '1//03OuOvyPJmIZ2CgYIARAAGAMSNwF-L9IresD0hjK9dg8BFAJwzVVna9uj76A4rWJW5jK9dg878eP4rWJW5jKjOg6VH7YcGBFAJwz'
groups: testers
file: app/build/outputs/apk/debug/app-debug.apk
view raw build-part.yml hosted with ❤ by GitHub

The code is simple, the pipeline will run

bash ./gradlew assembleDebug

and upload the file app/build/outputs/apk/debug/app-debug.apk using wzieba/Firebase-Distribution-Github-Action@v1.2.2 to the testers group.

You can notice that we‘ve put our appId and token that we already have.

Finally, our android.yml will look like this

name: Android Pull Request & Master CI & CD to Firebase
on:
pull_request:
branches:
- 'master'
push:
branches:
- 'master'
jobs:
test:
name: Run Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Unit tests
run: bash ./gradlew test --stacktrace
build:
name: Upload apk to App Tester
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: build release
run: bash ./gradlew assembleDebug
- name: upload artifact to Firebase App Distribution
uses: wzieba/Firebase-Distribution-Github-Action@v1.2.2
with:
appId: '1:994326970928:android:2ki953237460aib8a4341c'
token: '1//03OuOvyPJmIZ2CgYIARAAGAMSNwF-L9IresD0hjK9dg8BFAJwzVVna9uj76A4rWJW5jK9dg878eP4rWJW5jKjOg6VH7YcGBFAJwz'
groups: testers
file: app/build/outputs/apk/debug/app-debug.apk
apk:
name: Generate APK
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build debug APK
run: bash ./gradlew assembleDebug --stacktrace
- name: Upload APK
uses: actions/upload-artifact@v1
with:
name: app
path: app/build/outputs/apk/debug/app-debug.apk

And now, let’s push a commit and test what we’ve done. We can see in the GitHub Actions pipeline that we have a new job “Upload APK to App Tester”

Job Offers

Job Offers


    Developer (m/w/d) Backend/ Mobile

    Payback GmbH
    Cologne, Germany
    • Full Time
    apply now

    Lead Android Engineer

    ASOS
    London
    • Full Time
    apply now

    Senior Android Engineer – Big Release Team

    Zalando SE
    Berlin
    • Full Time
    apply now
Load more listings

OUR VIDEO RECOMMENDATION

, ,

Automating Android Workflows with Github Actions

Github Actions is the new kid on block regarding CI/CD products, and particularly it has been attracting a lot of attention from Software Engineers given its seamless integration with Github. It is not surprising that it has been quickly adopted both at open-source projects and private-source projects, with Android being no exception to that
READ MORE

Jobs

And we see that the “Upload artifact to Firebase App distribution” is done correctly

In Firebase, under “App Distribution” -> “Releases” we can also see that we have a new version uploaded. 1.0.0 is the versionName and (1) is the versionCode.

And here we delivered our Oreo ?

It’s time for testers to taste ?, any person added to “testers” group should receive an email like the one below

Just install Firebase App Tester, and you’ll find there every version added to Firebase… And for sure, you’ll be notified if a new Oreo (version) is ready to taste (test).

And lo, we finish with this tutorial. Any questions? Notes?… To your keyboards then ?

I’ve written some other Android-related content, and if you liked what you read here, you’ll probably also enjoy this:

“Continuous Integration/Delivery” for Android with GitHub Actions — Part 1

Dear developers, In this article I will show you how to automate the test execution and build of your Android app…

proandroiddev.com

 

Dynamic RecyclerView With Non-Defined Data Structure (From Unknown CSV Data Structure)

RecyclerView makes it easy to efficiently display large sets of data. You supply the data and define how each item…

medium.com

 

Implement shortcuts, the Android ‘iPhone 3D Touch’ equivalent

In this article, we are going to develop a simple call and opening camera Android app and integrate static “App…

proandroiddev.com

 

Android Library : Show a customized friendly calendar in your app

Overview:

medium.com

 

Sharing (knowledge) is caring ? Thanks for reading this article. Be sure to clap or recommend this article if you found it helpful. It means a lot to me.

If you need any help, join me on LinkedIn and GitHub.

 

 

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

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.

Menu