Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions .github/actions/increment-build-number/action.yml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/actions/map-environment/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Map Environment
description: 'Maps environment names to Expo environment names'
inputs:
environment:
required: true
description: 'The environment to map (dev, staging) or pass through (development, preview, production)'
outputs:
expo_environment:
description: 'The mapped Expo environment name (development, preview, production)'
value: ${{ steps.map-env.outputs.expo_environment }}
runs:
using: composite
steps:
- name: Map environment to Expo environment
id: map-env
shell: bash
run: |
case "${{ inputs.environment }}" in
"dev")
echo "expo_environment=development" >> $GITHUB_OUTPUT
;;
"staging")
echo "expo_environment=preview" >> $GITHUB_OUTPUT
;;
"development"|"preview"|"production")
echo "expo_environment=${{ inputs.environment }}" >> $GITHUB_OUTPUT
;;
*)
echo "Unknown environment: ${{ inputs.environment }}"
exit 1
;;
esac
14 changes: 10 additions & 4 deletions .github/actions/ota-update/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,26 @@ inputs:
version:
required: true
description: 'The version number'
build_number:
environment:
required: true
description: 'The build number'
description: 'The environment to update'
runs:
using: composite
steps:
- name: Set environment variables
shell: bash
run: |
echo "EXPO_PUBLIC_APP_VERSION=${{ inputs.version }}" >> $GITHUB_ENV
echo "EXPO_PUBLIC_BUILD_NUMBER=${{ inputs.build_number }}" >> $GITHUB_ENV

- name: Map environment
uses: ./.github/actions/map-environment
id: map-env
with:
environment: ${{ inputs.environment }}

- name: Perform OTA Update
shell: bash
run: |
eas update --channel ${{ inputs.channel }} \
--message "Update ${{ inputs.channel }} to ${{ inputs.version }} (build ${{ inputs.build_number }})"
--environment ${{ steps.map-env.outputs.expo_environment }} \
--message "Update ${{ inputs.channel }} to ${{ inputs.version }}"
32 changes: 0 additions & 32 deletions .github/actions/update-eas/action.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .github/workflows/create-dev-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,9 @@ jobs:
version_bump: 'none'
increment: false

- name: Update eas.json
uses: ./.github/actions/update-eas
with:
environment: dev
version: ${{ steps.version.outputs.version }}
build_number: ${{ vars.BUILD_NUMBER }}
vars: ${{ toJson(vars) }}

- name: Build Application
uses: ./.github/actions/build
with:
environment: ${{ github.event.inputs.environment }}
platform: ${{ github.event.inputs.platform }}
auto_submit: false

- name: Revert eas.json changes
if: always()
run: |
git restore eas.json
25 changes: 3 additions & 22 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,6 @@ jobs:
version_bump: ${{ github.event.inputs.version_bump }}
increment: ${{ github.event.inputs.action_type != 'build' }}

- name: Increment build number and save it in env variable
uses: ./.github/actions/increment-build-number
id: build_number
with:
gh_token: ${{ secrets.GT_PAT }}
current_build_number: ${{ vars.BUILD_NUMBER }}

- name: Update eas.json
uses: ./.github/actions/update-eas
with:
environment: ${{ github.event.inputs.environment }}
version: ${{ steps.version.outputs.version }}
build_number: ${{ steps.build_number.outputs.build_number }}
vars: ${{ toJson(vars) }}

- name: Build Application
if: github.event.inputs.action_type != 'ota_update'
uses: ./.github/actions/build
Expand All @@ -90,16 +75,12 @@ jobs:
- name: OTA Release
if: github.event.inputs.action_type == 'ota_update'
uses: ./.github/actions/ota-update
env: ${{ vars }}
env:
VARS: ${{ toJson(vars) }}
with:
channel: ${{ github.event.inputs.environment }}
environment: ${{ github.event.inputs.environment }}
version: ${{ steps.version.outputs.version }}
build_number: ${{ steps.build_number.outputs.build_number }}

- name: Revert eas.json changes
if: always()
run: |
git restore eas.json

- name: Generate Release Notes
if: github.event.inputs.action_type != 'build' && github.event.inputs.version_bump != 'none'
Expand Down
24 changes: 2 additions & 22 deletions .github/workflows/production-hotfix-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,6 @@ jobs:
version_bump: 'none'
increment: false

- name: Increment build number and save it in env variable
uses: ./.github/actions/increment-build-number
id: build_number
with:
gh_token: ${{ secrets.GT_PAT }}
current_build_number: ${{ vars.BUILD_NUMBER }}

- name: Update eas.json
uses: ./.github/actions/update-eas
with:
environment: production
version: ${{ steps.version.outputs.version }}
build_number: ${{ steps.build_number.outputs.build_number }}
vars: ${{ toJson(vars) }}

- name: Build and Submit
if: github.event.inputs.action_type == 'build_and_submit'
uses: ./.github/actions/build
Expand All @@ -66,16 +51,11 @@ jobs:
- name: OTA Update
if: github.event.inputs.action_type == 'ota_update'
uses: ./.github/actions/ota-update
env: ${{ vars }}
env:
VARS: ${{ toJson(vars) }}
with:
channel: production
version: ${{ steps.version.outputs.version }}
build_number: ${{ steps.build_number.outputs.build_number }}

- name: Revert eas.json changes
if: always()
run: |
git restore eas.json

- name: Create hotfix tag
uses: ./.github/actions/create-hotfix-tag
Expand Down
21 changes: 0 additions & 21 deletions .github/workflows/production-submit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,33 +34,12 @@ jobs:
version_bump: 'none'
increment: false

- name: Increment build number and save it in env variable
uses: ./.github/actions/increment-build-number
id: build_number
with:
gh_token: ${{ secrets.GT_PAT }}
current_build_number: ${{ vars.BUILD_NUMBER }}

- name: Update eas.json
uses: ./.github/actions/update-eas
with:
environment: production
version: ${{ steps.version.outputs.version }}
build_number: ${{ steps.build_number.outputs.build_number }}
vars: ${{ toJson(vars) }}

- name: Build and Submit
uses: ./.github/actions/build
with:
environment: production
platform: ${{ github.event.inputs.platform }}
auto_submit: true

- name: Revert eas.json changes
if: always()
run: |
git restore eas.json

# Uncomment and add your slack webhook url to send Slack notification after the build is submitted
# - name: Send Slack Notification
# id: slack
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ web-build/

# env
.env
.env.local

# native folers
android/
Expand Down
26 changes: 17 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,22 +193,30 @@ To replicate Figma design consistently on majority of mobile screen sizes, we sh

## Adding new `ENV` variables:

**Format**:
We highly recommend using EAS to manage environments.

- All variables must use the `EXPO_PUBLIC` prefix! e.g., `EXPO_PUBLIC_API_URL`
We map our environment names to these Expo environment names.

**Github**:
```
"dev": "development",
"staging": "preview",
"production": "production"
```

- There are two options for adding/managing env credentials:
Inside Github Actions we use an action to map the environments automatically.
To add new environment variable:

1. **Variables by a specific env**:
- Either add it through the Expo dashboard
- Or through eas cli:

> Settings -> Environments -> Select/add Env (dev, staging, production) -> Add a new variable
```
eas env:create <EXPO_ENVIRONMENT> --name <name> --value <value>
```

2. **Shared variables**:
> ⚠️ All variables must use the `EXPO_PUBLIC` prefix! e.g., `EXPO_PUBLIC_API_URL`

> Settings -> Secrets and Variables -> Actions -> Select Variables tab -> New repository variable
You can also pull variables from EAS to your local `.env` file:

```

eas env:pull <EXPO_ENVIRONMENT> --path <path-to-env-file>
```
8 changes: 4 additions & 4 deletions app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ declare const process: {
// expoProjectId: '46e1c780-9495-4650-93c8-7f465bf4e1d0',
// expoProjectOwner: 'strv-internal',
// appScheme: 'template-react-native-expo',
// otaUpdateUrl: 'https://u.expo.dev/46e1c780-9495-4650-93c8-7f465bf4e1d0',
// }

// Your project defaults
Expand All @@ -28,6 +29,7 @@ const config = {
expoProjectId: undefined,
expoProjectOwner: undefined,
appScheme: '',
otaUpdateUrl: '',
}

const environment = process.env.EXPO_PUBLIC_APP_ENV || 'dev'
Expand Down Expand Up @@ -69,9 +71,8 @@ const plugins: ExpoConfig['plugins'] = [
['expo-router'],
]

// UPDATE VERSION AND BUILDNUMBER
// UPDATE VERSION
const version = process.env.EXPO_PUBLIC_APP_VERSION || packageJson.version
const buildNumber = process.env.EXPO_PUBLIC_BUILD_NUMBER || '1'

const fallbackToCacheTimeout = 0
const otaUpdatePriority: OtaUpdatePriority = 'normal'
Expand All @@ -96,10 +97,10 @@ const expoConfig: ExpoConfig = {
},
updates: {
fallbackToCacheTimeout,
url: config.otaUpdateUrl,
},
assetBundlePatterns: ['**/*'],
ios: {
buildNumber,
supportsTablet: false,
bundleIdentifier: appIdentifier,
config: {
Expand All @@ -113,7 +114,6 @@ const expoConfig: ExpoConfig = {
bundler: 'metro',
},
android: {
versionCode: parseInt(buildNumber, 10),
adaptiveIcon: {
foregroundImage: './assets/adaptive-icon.png',
backgroundColor: '#FFFFFF',
Expand Down
Loading
Loading