Skip to content

Commit 69baa88

Browse files
committed
update expo and eas config to manage envs, and update README docs
1 parent 0436c39 commit 69baa88

9 files changed

Lines changed: 331 additions & 74 deletions

File tree

β€Ž.github/workflows/eas-build.ymlβ€Ž

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,17 @@ env:
66
EXPO_PUBLIC_OPENAPI_URL: ${{ vars.OPENAPI_URL }}
77

88
on:
9-
push:
10-
branches: [main]
9+
workflow_dispatch:
10+
inputs:
11+
profile:
12+
description: EAS build profile
13+
required: true
14+
default: production
15+
type: choice
16+
options:
17+
- development
18+
- staging
19+
- production
1120

1221
jobs:
1322
build:
@@ -32,4 +41,4 @@ jobs:
3241
run: pnpm install
3342

3443
- name: πŸš€ Build app
35-
run: eas build --non-interactive
44+
run: eas build --profile ${{ github.event.inputs.profile }} --non-interactive
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: πŸ”¨ EAS Development build
2+
3+
env:
4+
EXPO_PUBLIC_API_URL: ${{ vars.API_URL }}
5+
EXPO_PUBLIC_AUTH_URL: ${{ vars.AUTH_URL }}
6+
EXPO_PUBLIC_OPENAPI_URL: ${{ vars.OPENAPI_URL }}
7+
8+
on: workflow_dispatch
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: πŸ— Setup repo
15+
uses: actions/checkout@v5
16+
17+
- name: πŸ— Setup Node
18+
uses: actions/setup-node@v5
19+
with:
20+
node-version: 'lts/*'
21+
cache: 'pnpm'
22+
23+
- name: πŸ— Setup EAS
24+
uses: expo/expo-github-action@v8
25+
with:
26+
eas-version: latest
27+
token: ${{ secrets.EXPO_TOKEN }}
28+
29+
- name: πŸ“¦ Install dependencies
30+
run: pnpm install
31+
32+
- name: πŸš€ Build development client
33+
run: eas build --profile development --non-interactive

β€Ž.github/workflows/eas-update.ymlβ€Ž

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,17 @@ env:
66
EXPO_PUBLIC_OPENAPI_URL: ${{ vars.OPENAPI_URL }}
77

88
on:
9-
push:
10-
branches: [main]
9+
workflow_dispatch:
10+
inputs:
11+
channel:
12+
description: EAS Update channel (matches build profile)
13+
required: true
14+
default: production
15+
type: choice
16+
options:
17+
- development
18+
- staging
19+
- production
1120

1221
jobs:
1322
update:
@@ -31,5 +40,5 @@ jobs:
3140
- name: πŸ“¦ Install dependencies
3241
run: pnpm install
3342

34-
- name: πŸš€ Create update
35-
run: eas update --auto --non-interactive
43+
- name: πŸš€ Publish update
44+
run: eas update --branch ${{ github.event.inputs.channel }} --non-interactive
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: πŸš€ Release Production
2+
3+
env:
4+
EXPO_PUBLIC_API_URL: ${{ vars.API_URL }}
5+
EXPO_PUBLIC_AUTH_URL: ${{ vars.AUTH_URL }}
6+
EXPO_PUBLIC_OPENAPI_URL: ${{ vars.OPENAPI_URL }}
7+
8+
on: workflow_dispatch
9+
10+
jobs:
11+
prepare-production:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: πŸ— Setup repo
15+
uses: actions/checkout@v5
16+
17+
- name: πŸ— Setup Node
18+
uses: actions/setup-node@v5
19+
with:
20+
node-version: 'lts/*'
21+
cache: 'pnpm'
22+
23+
- name: πŸ— Setup EAS
24+
uses: expo/expo-github-action@v8
25+
with:
26+
eas-version: latest
27+
token: ${{ secrets.EXPO_TOKEN }}
28+
29+
- name: πŸ“¦ Install dependencies
30+
run: pnpm install
31+
32+
- name: πŸš€ Build production
33+
run: eas build --profile production --platform all --non-interactive
34+
35+
- name: Setup App Store Connect API key
36+
run: |
37+
echo "$APP_STORE_CONNECT_API_KEY" | base64 -d > "$ASC_API_KEY_PATH"
38+
env:
39+
APP_STORE_CONNECT_API_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY }}
40+
ASC_API_KEY_PATH: AuthKey_${{ vars.ASC_API_KEY_ID }}.p8
41+
42+
- name: πŸš€ Submit on stores
43+
run: eas submit --profile production --platform all --latest --non-interactive

β€ŽREADME.mdβ€Ž

Lines changed: 95 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,22 @@
33
πŸš€ Start UI <small>[native]</small> is an opinionated native starter repository created & maintained by the [BearStudio Team](https://www.bearstudio.fr/team) and other contributors.
44
It represents our team's up-to-date stack that we use when creating native apps for our clients.
55

6-
76
# Technologies
87

9-
<div align="center" style="margin: 0 0 16px 0"><img src=".github/assets/tech-logos.png" alt="Technologies logos of the starter" /></div>
10-
118
[βš™οΈ Node.js](https://nodejs.org), [🟦 TypeScript](https://www.typescriptlang.org/), [βš›οΈ React](https://react.dev/), [πŸ“± React Native](https://reactnative.dev/), [πŸš€ Expo](https://docs.expo.dev/), [πŸ” Better Auth](https://www.better-auth.com/), [πŸ–ŒοΈ Uniwind](https://uniwind.dev), [🧱 React Native Reusables](https://reactnativereusables.com), [🌴 Tanstack Form](https://tanstack.com/form/), [🌴 Tanstack Query](https://tanstack.com/query/), [πŸ‘‹ Hey API](https://heyapi.dev/)
129

1310
# Requirements
1411

15-
* [Node.js](https://nodejs.org) >= 22
16-
* [pnpm](https://pnpm.io/)
12+
- [Node.js](https://nodejs.org) >= 22
13+
- [pnpm](https://pnpm.io/)
1714

1815
# Getting Started
1916

2017
```bash
2118
pnpm create start-ui -t native myApp
2219
```
2320

24-
That will scaffold a new folder with the latest version of πŸš€ Start UI <small>[native]</small> πŸŽ‰
21+
That will scaffold a new folder with the latest version of πŸš€ Start UI [native] πŸŽ‰
2522

2623
# Installation
2724

@@ -33,7 +30,6 @@ pnpm install # Install dependencies
3330

3431
## Environment variables
3532

36-
3733
> [!TIP]
3834
> Using Expo Go, local development urls should not be `localhost`, use public IP instead
3935
@@ -54,6 +50,7 @@ pnpm gen:api
5450
A new folder `/src/lib/hey-api/generated` will be created with stuff like to combine use Tanstack Query to fetch data, based on env variables.
5551

5652
For example
53+
5754
```ts
5855
import { api } from '@/lib/hey-api/api';
5956

@@ -62,22 +59,41 @@ useQuery(api.bookGetByIdOptions({ path: { id: props.bookId } }));
6259

6360
# Run
6461

65-
6662
### Expo Go
6763

6864
```bash
6965
pnpm dev
7066
```
7167

72-
### Local build
68+
### Local builds
69+
70+
App name and bundle ID come from `app.config.ts`, evaluated at **prebuild** time. Each script runs `prebuild --clean` with the appropriate `APP_ENV`, then builds.
71+
72+
73+
| Script | App name | Build type | Need |
74+
| --------------------------------------------------- | --------------------------- | ---------- | ----------------------------------------- |
75+
| `dev:build:ios` / `dev:build:android` | Start UI [native] [Dev] | Dev/Debug | Local development, replacement of Expo Go |
76+
| `build:staging:ios` / `build:staging:android` | Start UI [native] [Staging] | Release | Install staging release version locally |
77+
| `build:production:ios` / `build:production:android` | Start UI [native] | Release | Install production version locally |
78+
7379

7480
```bash
75-
pnpm prebuild # To generate local builds
81+
# Development (debug build, dev client)
82+
pnpm dev:build:ios
83+
pnpm dev:build:android
84+
85+
# Staging (release build, internal testing)
86+
pnpm build:staging:ios
87+
pnpm build:staging:android
7688

77-
pnpm dev:ios # To run with local ios build
78-
pnpm dev:android # To run with local android build
89+
# Production (release build, store-like)
90+
pnpm build:production:ios
91+
pnpm build:production:android
7992
```
8093

94+
> [!TIP]
95+
> If the app name is wrong, the native project was generated with the wrong `APP_ENV`. Re-run the same build script β€” it includes `--clean` to regenerate the native project.
96+
8197
### Devtools
8298

8399
You can use @dev-plugins pressing `Shift + m` in your Expo terminal.
@@ -87,13 +103,12 @@ You can use @dev-plugins pressing `Shift + m` in your Expo terminal.
87103
Storybook is managed as a specific mode of the app that is launch apart in port 8083
88104

89105
```bash
90-
pnpm storybook # To run app in storybook mode
106+
pnpm dev:storybook # To run app in storybook mode
91107
```
92108

93109
> [!TIP]
94110
> You can open Storybook in another tab and switch between the app and Storybook by pressing `i` or `a` in each terminal.
95111
96-
97112
## Generate custom icons components from svg files
98113

99114
Put the custom svg files into the `app/components/icons/svg-sources` folder and then run the following command:
@@ -108,22 +123,73 @@ If you want to use the same set of custom duotone icons that Start UI is already
108123
> [!WARNING]
109124
> All svg icons should be svg files prefixed by `icon-` (example: `icon-externel-link`) with **square size** and **filled with `#000` color** (will be replaced by `currentColor`).
110125
126+
# GitHub repository configuration
127+
128+
The GitHub Actions workflows require the following configuration.
129+
130+
## Variables
131+
132+
Add at **Settings β†’ Secrets and variables β†’ Actions β†’ Variables**:
133+
134+
135+
| Variable | Description | Used by |
136+
| ---------------- | ------------------------------------------------------------------------------------ | ------------------------------------------------------------- |
137+
| `API_URL` | Base URL of your API server | EAS builds, preview, update, code quality, prepare-production |
138+
| `AUTH_URL` | Better Auth URL (e.g. `https://your-api.com/api/auth`) | EAS builds, preview, update, code quality, prepare-production |
139+
| `OPENAPI_URL` | OpenAPI schema URL (e.g. `https://your-api.com/openapi/app/schema`) | EAS builds, preview, update, code quality, prepare-production |
140+
| `ASC_API_KEY_ID` | App Store Connect API Key ID (e.g. `H3KZ2V5L32`) for the Release Production workflow | prepare-production |
141+
142+
143+
## Secrets
144+
145+
Add at **Settings β†’ Secrets and variables β†’ Actions β†’ Secrets**:
146+
147+
148+
| Secret | Description | Used by |
149+
| --------------------------- | ------------------------------------------------------------------------ | ----------------------------------------------------------------- |
150+
| `EXPO_TOKEN` | Expo access token for EAS CLI | EAS build, development build, update, preview, prepare-production |
151+
| `APP_STORE_CONNECT_API_KEY` | Base64-encoded App Store Connect API key (.p8 file) for store submission | prepare-production |
152+
153+
154+
Create an Expo token at [expo.dev/accounts/{account}/settings/access-tokens](https://expo.dev/accounts/_/settings/access-tokens).
155+
156+
For `APP_STORE_CONNECT_API_KEY`: export your App Store Connect API key as base64 (`base64 -i AuthKey_XXX.p8`) and store the result as the secret. The prepare-production workflow decodes it at runtime for `eas submit`.
157+
158+
For the **Release Production** workflow, also configure `eas.json` submit.production with your App Store Connect credentials (`ascAppId`, `ascApiKeyId`, `ascApiKeyIssuerId`, `ascApiKeyPath`), and set the `ASC_API_KEY_ID` variable to match your key ID (used in the key filename).
159+
160+
## Workflows
161+
162+
163+
| Workflow | Trigger | Description |
164+
| ------------------------- | ------------ | --------------------------------------------------------------------------------------- |
165+
| **EAS build** | Manual | Build app β€” select profile (development, staging, production) in the GitHub UI |
166+
| **EAS Development build** | Manual | Build development client (internal) |
167+
| **EAS Update** | Manual | Publish OTA update β€” select channel (development, staging, production) in the GitHub UI |
168+
| **EAS Preview** | Pull request | Publish preview update on PR branch |
169+
| **Release Production** | Manual | Build production, then submit to App Store and Play Store |
170+
171+
172+
### EAS build profiles
173+
174+
175+
| Profile | Purpose |
176+
| --------------- | ------------------------------------------------------------------------ |
177+
| **development** | Dev client for local development (internal distribution) |
178+
| **staging** | Internal distribution for testers (never sent to stores) |
179+
| **production** | Store build (auto-increments, submitted via Release Production workflow) |
180+
181+
111182
# EAS Preview
112183

113184
To be able to use previews on PR, you have to setup your project with EAS
114185

115-
1. Setup Expo access token
116-
* Create it: https://expo.dev/accounts/{account}/settings/access-tokens
117-
* Add it as GitHub repository secrets: https://github.com/xxx/xxx/settings/secrets/actions
118-
2. Add GitHub repository variables: https://github.com/xxx/xxx/settings/variables/actions
119-
* `API_URL`
120-
* `AUTH_URL`
121-
* `OPENAPI_URL`
122-
3. Setup Expo project: https://expo.dev/
123-
* Create your project
124-
* Get project's id
125-
* Set as `EXPO_PROJECT_ID` in `app.config.ts`
126-
4. Setup eas
127-
* `eas login`
128-
* `eas init --id {projectid}`
129-
* `eas update:configure`
186+
1. Configure [GitHub variables and secrets](#github-repository-configuration) (see above)
187+
2. Setup Expo project: [https://expo.dev/](https://expo.dev/)
188+
- Create your project
189+
- Get project's id
190+
- Set as `EAS_PROJECT_ID` in `app.config.ts`
191+
3. Setup eas
192+
- `eas login`
193+
- `eas init --id {projectid}`
194+
- `eas update:configure`
195+

0 commit comments

Comments
Β (0)