Skip to content

Instantly share code, notes, and snippets.

@j0nl1
Created October 19, 2022 10:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j0nl1/9f89147c1ab17112e17739fe044157c6 to your computer and use it in GitHub Desktop.
Save j0nl1/9f89147c1ab17112e17739fe044157c6 to your computer and use it in GitHub Desktop.
Firebase distribution using Fastlane
name: build-app
on:
workflow_dispatch:
inputs:
environment:
description: Define an environment to deploy
required: true
default: beta
platform:
description: App Platform
required: true
default: android
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Add git credentials
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Install Pods
if: ${{ github.event.inputs.platform == 'ios'}}
run: npx pod-install
- name: Build App
run: fastlane ${{ github.event.inputs.platform }} ${{ github.event.inputs.environment }}
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
FIREBASE_IOS_APP_ID: ${{ secrets.FIREBASE_IOS_APP_ID }}
FIREBASE_ANDROID_APP_ID: ${{ secrets.FIREBASE_ANDROID_APP_ID }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
#
platform :ios do
desc "Build iOS Application"
private_lane :build do
gym(
workspace: './ios/PROJECT.xcworkspace',
scheme: "SCHEME_PROJECT",
export_method: 'development'
)
end
desc "Increment iOS build number"
private_lane :increment_ios_build_number do
package = load_json(json_path: './package.json')
version = package['version']
project_path = './ios/PROJECT.xcodeproj'
increment_version_number(
xcodeproj: project_path,
version_number: version
)
increment_build_number(
xcodeproj: project_path
)
end
desc "Ship to Firebase"
lane :beta do
build
firebase_app_distribution(
app: ENV["FIREBASE_IOS_APP_ID"],
firebase_cli_token: ENV["FIREBASE_TOKEN"],
groups: "qa-team, dev-team",
release_notes: "Lots of amazing new features to test out!",
)
increment_ios_build_number
commit_version_bump(message: 'Bump build', xcodeproj: './ios/PROJECT.xcodeproj')
push_to_git_remote
end
end
platform :android do
desc "Build Android Application"
private_lane :build do
build_android_app(task: 'assembleRelease', project_dir: 'android/')
end
desc "Increment Android versionCode"
private_lane :increment_android_version_code do
gradle_path = "./android/app/build.gradle"
package = load_json(json_path: './package.json')
version = package['version']
increment_version_name(
gradle_file_path: gradle_path,
version_name: version
)
increment_version_code(
gradle_file_path: gradle_path
)
end
desc "Ship to Firebase"
lane :beta do
build
firebase_app_distribution(
app: ENV["FIREBASE_ANDROID_APP_ID"],
firebase_cli_token: ENV["FIREBASE_TOKEN"],
groups: "qa-team, dev-team",
release_notes: "Lots of amazing new features to test out!",
)
increment_android_version_code
git_commit(path: ['./android/app/build.gradle'], message: 'Bump versionCode')
push_to_git_remote
end
end
# Autogenerated by fastlane
#
# Ensure this file is checked in to source control!
gem 'fastlane-plugin-firebase_app_distribution'
gem 'fastlane-plugin-increment_version_code'
gem 'fastlane-plugin-increment_version_name'
gem 'fastlane-plugin-load_json'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment