# TGS-APP
## Table of Contents
- ### [Versioning](#1)
- ### [Environment](#2)
- ### [Deployment](#3)
- ### [Troubleshooting](#4)
_
Note: Versioning and Deployment use fastlane and shell scripts. Before using the commands of these sessions, please make sure:
_
* _You have already installed __fastlane__ using
`brew install fastlane`._
* _Set execute permission to shell script files `chmod +x ./bin/bump.sh ./bin/upload.sh`._
Versioning
- Auto increment `iOS Build Number`:
```
$ yarn bump ios
```
- Auto increment `Android Version Code`:
```
$ yarn bump android
```
This commands below will increase fully app version, includes:
1. iOS version number + build number.
2. Android version name + version code.
3. __package.json__ version. (base app version)
App version number has three components: `major.minor.patch` and should be the single source of truth
- Auto increment `major` (_for breaking changes_):
```
$ yarn bump major
```
- Auto increment `minor` (_for new functionality_):
```
$ yarn bump minor
```
- Auto increment `patch` (_for minor changes or bug fixes_):
```
$ yarn bump patch
```
Environment
This app has 3 .env files appropriates to 2 environments.:
1. __.env__ for current config
2. __.env.dev__ for development config
3. __.env.prod__ for production config
### Development
* Android:
```
$ yarn build-bundle-dev
```
* iOS (after this command, use __Xcode__ to continue the process)
```
$ yarn use-dev
```
### Production
* Android:
```
$ yarn build-bundle
```
* iOS (after this command, use __Xcode__ to continue the process)
```
$ yarn use-prod
```
iOS:
When using the deployment script, you don't need to change the project scheme to switch the environment.
When release deployment, make sure you removed deprecated __RCTWebView__ or run `pod install` to let it remove for you.
Deployment
Auto uploading Android App Bundle to __Play Console__, track Internal Beta:
* Normal usage
```
$ yarn upload playstore
```
* Upload with changelog (can combine with other usages)
```
$ yarn upload playstore -m "your_change"
```
* This command always builds a new __.aab__ file, to ignore building new one, use with option
```
$ yarn upload playstore rebuild:false
```
Auto uploading .ipa to __TestFlight__, beta
* Coming soon...
_Note: Please make sure you increased app version before deployment._
Troubleshooting
- '__RCTComponentEvent.h__' file not found\
Run `pod install` to fix the problem.
- /bin/sh: ./bin/bump.sh: __Permission denied__\
[See note](#5)
- No authentication parameters were specified. These must be provided in order to authenticate with Google\
If you already have _play_store_json_key.json_, go to root folder and run `fastlane supply init`.