## Environments
- Three main environments
- development
- local development
- test
- when doing beta testing
- sharing to team members
- production
- production
- Differences
- development
- android uses store
- .test prefix
- test
- .test prefix
- when doing beta testing
- posthog analytics on
- release build
- production
- posthog analytics on
- release build
- to generate
- `npx expo run:android --variant test`
### How is this implemented
Based on the flag you give when running it in android
Also has mirrored env settings for eas build (but will prob not be used due to costs)
### Flow
-
- Run command with correct flag
- Automatically uses the .env file with set flags
- EXPO_PUBLIC_APP_VARIANT=production
- EXPO_PUBLIC_POSTHOG_ENABLED=true
- In app.config.js, uses it to set other parameters
- In `_layout.app`, is used to initialize providers (ex. PostHog)
## Building
### Setup
```
gem install --fastlane
```
### Explanation
`.env` and `eas.json` should have mirrored variables
There is no dev / staging / prod for app builds, just debug and release
So instead, "staging" (will now refer as test) builds will be buildable with either debug or release:
- test debug is for ivan and stuff maybe
- test release is for distribution for testing
### Local Development
Will require the correct `.env` files (see below):
```
.env
.env.development
.env.test
.env.production
```
To run, `run expo prebuild` then do one of the following:
```
npx expo run:android --variant development
npx expo run:ios --configuration Debug
npx expo run:android --variant test
npx expo run:ios --configuration Test
npx expo run:android --variant release
npx expo run:ios --configuration Release
```
### General building
```
# For development builds
eas build --profile development --platform ios --local
eas build --profile development --platform android --local
# For test builds (APK)
eas build --profile test_debug --platform all --local
# For test builds (Store format)
eas build --profile test_release --platform android --local
eas build --profile test_release --platform ios --local
# For production builds
eas build --profile production --platform all --local
```
### For testers
#### iOS
```
eas build --profile test_release --platform ios --local
```
This will generate a build with id `com.goldfishnotes.goldfish.mobile.test`
Once .ipa is generated, upload it using `eas submit`
And set up related config in `Goldfish Notes (Test)` app on App Store Connect
#### Android
```
eas build --profile test_release --platform ios --local
```