Skip to content

Build App and Upload #143

Build App and Upload

Build App and Upload #143

Workflow file for this run

name: "Build App and Upload"
on:
# manual trigger but change to any supported event
# see addl: https://www.andrewhoog.com/post/how-to-build-react-native-android-app-with-github-actions/#3-run-build-workflow
workflow_dispatch:
inputs:
buildPlatform:
description: 'Platform to Build'
required: true
default: 'all'
type: choice
options:
- all
- ios
- android
release:
types: [published]
jobs:
build_ios:
runs-on: macos-latest
# build for ios if platform is ios or all, or if triggered by a release
if: github.event_name == 'release' || inputs.buildPlatform == 'all' || inputs.buildPlatform == 'ios'
steps:
- name: List Xcode Installs
run: sudo ls -1 /Applications | grep "Xcode"
- name: Select Xcode 16.1
run: sudo xcode-select -s /Applications/Xcode_16.1.app/Contents/Developer
- name: Check Xcode Version
run: /usr/bin/xcodebuild -version
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Fastlane and Fix CocoaPods
run: |
sudo gem install cocoapods -v 1.15.2
sudo gem install fastlane -NV
fastlane --version
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'
- name: Install Dependencies
run: npm install
- name: Expo Prebuild [iOS]
run: |
npx expo prebuild --platform ios --npm
- name: Fastlane Build [iOS]
run: fastlane ios build
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }}
ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }}
ASC_KEY_BASE64: ${{ secrets.ASC_KEY_BASE64 }}
GIT_AUTHORIZATION: ${{ secrets.GIT_AUTHORIZATION }}
CHANGELOG: ${{ github.event.release.body }}
build_android:
runs-on: ubuntu-latest
# build for android if platform is android or all, or if triggered by a release
if: github.event_name == 'release' || inputs.buildPlatform == 'all' || inputs.buildPlatform == 'android'
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Fastlane
run: |
sudo gem install fastlane -NV
fastlane --version
- name: Install JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '21'
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'
- name: Install Dependencies
run: npm install
- name: Write Google Maps API Key to app.json
run: |
sed -i "s/{{GOOGLE_MAPS_KEY}}/$GOOGLE_MAPS_KEY/g" app.json
env:
GOOGLE_MAPS_KEY: ${{ secrets.GOOGLE_MAPS_KEY }}
- name: Expo Prebuild [Android]
run: |
npx expo prebuild --platform android --npm
- name: Modify build.gradle
run: |
run: |
# Find the build.gradle file and add lintOptions if not present
if grep -q 'lintOptions {' android/app/build.gradle; then
echo 'lintOptions already present'
else
echo 'Adding lintOptions to build.gradle'
sed -i '/android {/a \ lintOptions {\n checkReleaseBuilds false\n }' android/app/build.gradle
fi
- name: Decode Signing Keystore
run: |
echo "${{ secrets.AAB_SIGNING_KEY }}" | base64 --decode > "./android/app/maroon-rides-release-key.jks"
- name: Fastlane Build [Android]
run: |
fastlane android build
env:
KEY_ALIAS: ${{ secrets.AAB_KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.AAB_PASSWORD }}
STORE_PASSWORD: ${{ secrets.AAB_PASSWORD }}
KEY_PATH: ${{ github.workspace }}/android/app/maroon-rides-release-key.jks
GOOGLE_PLAY_KEY: ${{ secrets.GOOGLE_PLAY_KEY }}
PACKAGE_NAME: "com.maroonrides.maroonrides"
APP_GRADLE_FILE: ${{ github.workspace }}/android/app/build.gradle
- uses: actions/upload-artifact@v4
with:
name: app-bundle.aab
path: ./android/app/build/outputs/bundle/release/app-release.aab
- name: Set outputs
id: git_sha
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Upload to Play Store [Android]
run: fastlane android upload
env:
GOOGLE_PLAY_KEY: ${{ secrets.GOOGLE_PLAY_KEY }}
RELEASE_NAME: ${{ github.event.release.tag_name || steps.git_sha.outputs.sha_short }}
PACKAGE_NAME: "com.maroonrides.maroonrides"