-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathREADME.ejs
230 lines (154 loc) · 6.78 KB
/
README.ejs
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<%= projectName %>
====================================
# Prerequisites
Follow the [official guide](https://facebook.github.io/react-native/docs/getting-started.html) to properly setup your environment.
We highly recommend using [nvm](https://github.com/creationix/nvm) instead of brew or aptitude to install nodejs.
# Proyect Set Up
## One time setup
<%_ if(features.hasFirebase) { _%>
### Google Services files setup
You must create a folder with the google-services.json files into the corresponding platform like this:
#### Android
`android/app/google-services`
#### IOS
`ios/GoogleServices`
then put the corresponding google services files on each one.
this folders are ignored by default.
The `firebaseFilesScript.sh` will get the build environment and setup the needed google service file for it.
<%_ } _%>
### ENV setup
---
Each environment has its env file with the following filename format:
`.[environment].env`
You must create the following env files corresponding to each environment.
`.dev.env`
`.stage.env`
`.production.env`
Create all the env files in the root with the following vars corresponding to the environment that belongs:
```
API_BASE_URL=https://XXXXXXXX
<%_ if(features.pushnotifications) { _%>
NOTIFICATIONS_SENDER_ID=XXXXXXXX
<%_ } _%>
OTHER_ENV_VARs=XXXXXXXXXX
```
---
### Android
---
Set the following variables in `~/.gradle/gradle.properties`
```
MY_PROYECT_RELEASE_STORE_FILE=my_proyect-key.keystore
MY_PROYECT_RELEASE_KEY_ALIAS=my_proyect-key
MY_PROYECT_RELEASE_STORE_PASSWORD=xxxxxxxx
MY_PROYECT_RELEASE_KEY_PASSWORD=xxxxxxxx
```
Update the file `android/app/build.gradle` according to this [guide](https://facebook.github.io/react-native/docs/signed-apk-android.html#adding-signing-config-to-your-app-s-gradle-config) using the variables set in `~/.gradle/gradle.properties`
Generate the file `my_proyect-key.keystore` using the following command from your terminal and place it in the `android/app` folder
```
$ keytool -genkey -v -keystore my_proyect-key.keystore -alias my_proyect-key -keyalg RSA -keysize 2048 -validity 10000
Enter keystore password: xxxxx
Re-enter new password: xxxxx
What is your first and last name?
[Unknown]: wolox
What is the name of your organizational unit?
[Unknown]: wolox
What is the name of your organization?
[Unknown]: wolox
What is the name of your City or Locality?
[Unknown]: wolox
What is the name of your State or Province?
[Unknown]: wolox
What is the two-letter country code for this unit?
[Unknown]: wx
Is CN=wolox, OU=wolox, O=wolox, L=wolox, ST=wolox, C=wx correct?
[no]: yes
Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 10,000 days
for: CN=wolox, OU=wolox, O=wolox, L=wolox, ST=wolox, C=wx
Enter key password for <my_proyect-key>
(RETURN if same as keystore password): xxxxx
Re-enter new password: xxxxx
[Storing my_proyect-key.keystore]
```
---
### iOS
---
We use [FastLane](https://github.com/Wolox/fastlane-mobile) and few of its plugins to automate many ios tasks:
- Interact with Apple Developer Portal and iTunes Connect.
- Automate code signing (Certificates and provisioning profiles handling. Take a look at [match](https://github.com/fastlane/fastlane/tree/master/match))
- Uploading builds to testflight ([gym](https://github.com/fastlane/fastlane/tree/master/pilot))
#### FastLane setup
Make sure you have the latest version of the Xcode command line tools installed:
```
xcode-select --install
```
Follow this [guide](https://github.com/rvm/rvm) to properly install rvm. This tool will easily allow you to install and change different ruby versions.
Run `rvm -v` to check that it was successfully installed.
The last step is installing Fastlane gems:
```bash
gem install bundler
bundle install
```
# Running aplication
This proyect supports many `Debug`, `QA`, `Stage`, and `Production` environments.
The following enviorments are supported:
##### iOS
- Dev - Scheme: `dev`
- Dev - Configuration: `Debug`
- QA - Scheme: `qa`
- QA - Configurations: `Debug` or `QA`
- Stage - Scheme: `stage`
- Stage - Configurations: `Debug` or `Stage`
- Production - Scheme: `production`
- Production - Configurations: `Debug` or `Production`
**The default configuration is `Debug`.**
##### Android
- Dev/QA - Debug: `qaDebug`
- Dev/QA - Release: `qaRelease`
- Stage - Debug: `stageDebug`
- Stage - Release: `stageRelease`
- Production - Debug: `productionDebug`
- Production - Release: `productionRelease`
To run a Android/iOS simulator with determinated environment, just run:
**ANDROID**
`react-native run-android --variant=[build variant]`
For Example:
`react-native run-android --variant=qaDebug`
or
`react-native run-android --variant=qaRelease`
**iOS**
`react-native run-ios --scheme [scheme] [--configuration [configuration]](optional)`
For Example:
`react-native run-ios --scheme qa`(Debug configuration)
or
`react-native run-ios --scheme dev --configuration Release`
---
# Outputs
## Android
Use the the command in the rootpath to generate the APK:
```
yarn run android:build.[environment]
```
For example:
```
yarn run android:build.qa
```
It will generate the apk file in the path `android/app/build/outputs/apk/[environment]/release/app-[environment]-release.apk`
### Uploading build to Firebase App Distribution
Use the following commands from <%= projectName %>/android:
1. Install gems with: `bundle install`
2. Authenticate with Firebase using Firebase-CLI: `firebase login`. If you don't have `Firebase-CLI` installed you can do it with the following command: `npm install -g firebase-tools`.
3. Run: `bundle exec fastlane android distribute_qa`.
#### Available Lanes
There is a lot of fastlane lanes that will help you to make deploys to Firebase App Distribution and Google Play Console too.
Follow the instructions in the [Fastlane README](android/fastlane/README.md) to see all available lanes.
## iOS
### Uploading build to testflight
Use the following commands from <%= projectName %>/ios:
1) We need to create the app in the AppStore first if it isn't already created. You must be use `bundle exec fastlane ios create_development_app`. The lane depends of environment, you can use `bundle exec fastlane ios create_stage_app` or ` bundle exec fastlane ios create_production_app`
2) Then you must be use `bundle exec fastlane ios release_qa` also there are other lanes to deploy to differents environments. You can use `bundle exec fastlane ios release_stage` or
`bundle exec fastlane ios release_production`
Follow the instructions in the [Fastlane README](ios/README.md) that will help you to create apps, certificates, make deploys and more.
---
#### Available Lanes
There is a lot of fastlane lanes that will help you to create apps, certificates, make deploys and more.
Follow the instructions in the [Fastlane README](ios/fastlane/README.md) to see all available lanes.