-
Notifications
You must be signed in to change notification settings - Fork 5
163 lines (132 loc) · 5.17 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
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-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"
- name: Select Xcode 15.2
run: sudo xcode-select -s /Applications/Xcode_15.2.app/Contents/Developer
- name: Check Xcode Version
run: /usr/bin/xcodebuild -version
- name: Checkout Repository
uses: actions/checkout@v3
- 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@v3
with:
node-version: '20.x'
- name: Cache NPM Dependencies
uses: actions/cache@v4
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 [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: '20.x'
- name: Cache NPM Dependencies
uses: actions/cache@v4
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: 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: Upload to Play Store [Android]
run: fastlane android upload
env:
GOOGLE_PLAY_KEY: ${{ secrets.GOOGLE_PLAY_KEY }}
PACKAGE_NAME: "com.maroonrides.maroonrides"