Skip to content

Commit

Permalink
update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
bwees committed Aug 27, 2024
1 parent a9ece0e commit 307aeda
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 44 deletions.
63 changes: 60 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ 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]
Expand All @@ -12,6 +22,10 @@ on:
jobs:
build_ios:
runs-on: macos-13

# 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"
Expand Down Expand Up @@ -43,7 +57,7 @@ jobs:
path: '**/node_modules'
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node_modules-
${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install
Expand All @@ -53,11 +67,54 @@ jobs:
npx expo prebuild --platform ios --npm
- name: Fastlane Beta [iOS]
run: fastlane beta
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 }}
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@v3

- name: Install Fastlane
run: |
gem install fastlane -NV
fastlane --version
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '20.x'

- name: Cache npm dependencies
uses: actions/cache@v2
id: cache
with:
path: '**/node_modules'
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install

- name: Expo Prebuild [Android]
run: |
npx expo prebuild --platform android --npm
- name: Fastlane Beta [iOS]
run: fastlane android build
working-directory: ./android
env:
GOOGLE_PLAY_KEY: ${{ secrets.GOOGLE_PLAY_KEY }}
PACKAGE_NAME: "com.maroonrides.maroonrides"
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"backgroundColor": "#191919"
}
},
"package": "com.anonymous.reactnativeboilerplate"
"package": "com.maroonrides.maroonrides"
},
"web": {
"favicon": "./assets/favicon.png",
Expand Down
77 changes: 37 additions & 40 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,26 @@

default_platform(:ios)

ASC_KEY_ID = ENV['ASC_KEY_ID']
ASC_ISSUER_ID = ENV['ASC_ISSUER_ID']
ASC_KEY_BASE64 = ENV['ASC_KEY_BASE64']
TEAM_ID = ENV['TEAM_ID']

# use changelog env var if set, otherwise use default
CHANGELOG = ENV['CHANGELOG'] || "Howdy! This update includes some bug fixes and performance improvements. Please let us know if you have any feedback or questions through TestFlight! Thanks and Gig 'Em!"

# setup app store connect api key on local machine
app_store_connect_api_key(
key_id: ASC_KEY_ID,
issuer_id: ASC_ISSUER_ID,
key_content: ASC_KEY_BASE64,
is_key_content_base64: true
)


platform :ios do
lane :setup_keychain do
setup_keychain(
keychain_name: "fastlane_tmp_keychain",
keychain_password: "fastlane_tmp_keychain",
default_keychain: true,
unlock: true
)
end

desc "Setup generated Xcode project for build"
lane :prebuild do
setup_ci if ENV['CI']


ASC_KEY_ID = ENV['ASC_KEY_ID']
ASC_ISSUER_ID = ENV['ASC_ISSUER_ID']
ASC_KEY_BASE64 = ENV['ASC_KEY_BASE64']
TEAM_ID = ENV['TEAM_ID']

# setup app store connect api key on local machine
app_store_connect_api_key(
key_id: ASC_KEY_ID,
issuer_id: ASC_ISSUER_ID,
key_content: ASC_KEY_BASE64,
is_key_content_base64: true
)

match(
type: 'development',
app_identifier: 'com.bwees.reveille-rides',
Expand All @@ -61,7 +49,6 @@ platform :ios do
git_basic_authorization: Base64.strict_encode64(ENV["GIT_AUTHORIZATION"])
)


update_project_team(
path: "ios/MaroonRides.xcodeproj",
teamid: TEAM_ID
Expand Down Expand Up @@ -90,21 +77,9 @@ platform :ios do
value: false
)
end

desc "Push a new release build to the App Store"
lane :release do
prebuild

# get current build number app_store_build_number and increment it
increment_build_number(xcodeproj: "ios/MaroonRides.xcodeproj", build_number: app_store_build_number() + 1)

build_app(workspace: "ios/MaroonRides.xcworkspace", scheme: "MaroonRides")

upload_to_app_store(skip_metadata: true, skip_screenshots: true)
end

desc "Push a new beta build to TestFlight"
lane :beta do
desc "Push a new build to TestFlight"
lane :build do
prebuild

increment_build_number(xcodeproj: "ios/MaroonRides.xcodeproj", build_number: app_store_build_number(live: false) + 1)
Expand All @@ -120,3 +95,25 @@ platform :ios do
)
end
end

# fastlane/Fastfile
default_platform(:android)

platform :android do
desc "Build APK with Gradle"
lane :build_apk do
gradle(
task: "assembleRelease",
build_type: "Release",
)
end

desc "Push a new build to Google Play Store"
lane :build do
build_apk

upload_to_play_store(track: 'internal', apk: './build/outputs/apk/release/app-release.apk') # Adjust if using AAB
end


end

0 comments on commit 307aeda

Please sign in to comment.