Building and deploying an Android app can often be a repetitive and time-consuming task. Automating the submission process using GitHub Actions streamlines development workflows, reduces manual errors, and ensures consistent app releases. If you’re using Expo to develop your Android app, you’re in luck – Expo provides tools that integrate seamlessly with CI/CD pipelines.
In this guide, we’ll walk through setting up a GitHub Actions workflow to automate the submission of your Expo Android app.
To make sense of the post you may need to read my previous post Automate Your Expo Builds with EAS Using GitHub Actions: A Step-by-Step Guide (Android)
Prerequisites
React Native project
Must have created your first build How to create your first build
Must have submitted your android app first time How to submit expo app to stores
Step 1: Define Your GitHub Actions Workflow to build the app
Create a GitHub Actions workflow file in your repository at .github/workflows/android-submission.yml and paste the code below. If you’ve read the previous post, your workflow file should look similar to this. This code builds the .aab file for submission.
name: Android App Build
on:
push:
branches:
- staging
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup repo
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20.x
cache: "npm"
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Setup Expo
uses: expo/expo-github-action@v8
with:
expo-version: latest
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build Android app
run: eas build --platform android --profile production --local --output ${{ github.workspace }}/app-release.aab
NB:
If you notice, the key change from the previous article is the replacement of preview
with production
in the --profile setting. This means we’re now building for production instead of testing. For more details on configuring profiles Configure EAS Build with eas.json.
Step 2: Submitting the app
The command below should look familiar if you’ve submitted an Android app with Expo via the terminal. It takes the app you previously built and submits it directly to the store.
- name: Submit to Google Play
run: |
eas submit -p android --profile production --path ${{ github.workspace }}/app-release.aab --non-interactive
Step 3: Test the Workflow
Push your changes to the staging (or specific branch you put in workflow) branch to trigger the workflow. Monitor the Actions tab in your GitHub repository to ensure the steps execute successfully. If the submission succeeds, your app will be uploaded to the Google Play Console and you should see it in your internal test.
Tips and Best Practices
Versioning: Ensure your version and versionCode in app.json or app.config.js are updated automatically using scripts or manual steps learn more.
Testing: Run unit, integration tests or e2e test before submitting ensure app stability learn more.
Thanks for reading till the end.
Next time, I'll cover automating build and submission of iOS app to the Apple store respectively. Stay tuned!!!.
Top comments (1)
Thanks for sharing this!