Skip to content

Instantly share code, notes, and snippets.

@ryanhanwu
Created February 2, 2021 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanhanwu/0532c50f91c77388043a3c0cf85d46b8 to your computer and use it in GitHub Desktop.
Save ryanhanwu/0532c50f91c77388043a3c0cf85d46b8 to your computer and use it in GitHub Desktop.
Build React Native Android App and submit to Firebase App Distribution via Github Actions
name: Android CI
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
build:
runs-on: macOS-latest
steps:
- name: Checkout Source Code
uses: actions/checkout@v2
- name: Generate keys from Secrets
env:
# Service Account Key JSON file https://docs.fastlane.tools/actions/supply/#setup
FIREBASE_ANDROID_JSON: ${{secrets.FIREBASE_ANDROID_JSON}}
run: |
echo "$FIREBASE_ANDROID_JSON" >> android/firebase-app-distribution.json
- name: Setup Node.js 12
uses: actions/setup-node@v2
with:
node-version: '12'
- name: Install React Native Project dependencies
run: |
yarn
- name: Build Android Project
run: |
curl https://raw.githubusercontent.com/facebook/react-native/master/template/android/app/debug.keystore > android/app/debug.keystore
cd android && ./gradlew clean && ./gradlew build --refresh-dependencies
- name: Setup Ruby 2.7
uses: actions/setup-ruby@v1
with:
ruby-version: '2.7'
- name: Install Fastlane
run: |
bundle install
- name: Run Fastlane
uses: maierj/fastlane-action@v2.0.0
with:
lane: 'beta_ci'
subdirectory: 'android'
default_platform(:android)
platform :android do
desc "Deploy a new version to the Firebase App Distribution"
lane :beta_ci do
gradle(task: "clean assembleRelease")
firebase_app_distribution(
app: "1:123123123123123123123", #https://console.firebase.google.com/u/2/project/
service_credentials_file: "./firebase-app-distribution.json", # Created from android_workflow.yml steps
groups: "qa-team"
)
end
end
source "https://rubygems.org"
gem "fastlane"
plugins_path = File.join(File.dirname(__FILE__), 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
gem 'fastlane-plugin-firebase_app_distribution'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment