Skip to content

Commit

Permalink
Merge pull request #45 from prototypsthlm/osa-1-build-submit-new-upgr…
Browse files Browse the repository at this point in the history
…aded-expo-49

set up new EAS update, build & submit
  • Loading branch information
simonkropp authored Dec 7, 2023
2 parents e3381a9 + 3030c4b commit 4871a6d
Show file tree
Hide file tree
Showing 16 changed files with 105 additions and 276 deletions.
8 changes: 8 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
EXPO_PUBLIC_API_URL=
EXPO_PUBLIC_API_KEY=
EXPO_PUBLIC_AUTH_DOMAIN=
EXPO_PUBLIC_DATABASE_URL=
EXPO_PUBLIC_PROJECT_ID=
EXPO_PUBLIC_STORAGE_BUCKET=
EXPO_PUBLIC_MESSAGE_SENDER_ID=
EXPO_PUBLIC_APP_ID=
37 changes: 37 additions & 0 deletions .github/workflows/eas-build-and-submit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: EAS Build & Submit
on:
release:
types: [published]

jobs:
build:
name: EAS Build & Submit
runs-on: ubuntu-latest
steps:
- name: Check for EXPO_TOKEN
run: |
if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then
echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets. Learn more: https://docs.expo.dev/eas-update/github-actions"
exit 1
fi
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: yarn

- name: Setup EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}

- name: Install dependencies
run: yarn install

- name: Build iOS app
run: eas build --platform all --profile production --auto-submit --non-interactive
38 changes: 38 additions & 0 deletions .github/workflows/eas-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: EAS Update
on:
push:
branches:
- master

jobs:
update:
name: EAS Update
runs-on: ubuntu-latest
steps:
- name: Check for EXPO_TOKEN
run: |
if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then
echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets. Learn more: https://docs.expo.dev/eas-update/github-actions"
exit 1
fi
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: yarn

- name: Setup EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}

- name: Install dependencies
run: yarn install

- name: Publish update
run: eas update --channel production --message ${{ github.event.head_commit.message }}
53 changes: 0 additions & 53 deletions .github/workflows/master.yml

This file was deleted.

65 changes: 0 additions & 65 deletions .github/workflows/upload-master-ios.yml

This file was deleted.

3 changes: 0 additions & 3 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ import Main from "./src/Main";
import * as SplashScreen from "expo-splash-screen";

import useCachedResources from "./src/hooks/useCachedResources";
import { useOverTheAirUpdate } from "./src/hooks/useOverTheAirUpdate";

// Ensure Splash isn't automatically hidden
SplashScreen.preventAutoHideAsync();

const App = () => {
const isLoadingComplete = useCachedResources();
// Check and apply OTA updates
useOverTheAirUpdate();

useEffect(() => {
if (isLoadingComplete) {
Expand Down
16 changes: 5 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ Make sure you have [Node.js v16.x](https://nodejs.org/en/download/) and [Yarn v1

Create `.env` file at the root of the project. Vars are in 1Password under `Marine-Plastic/Ocean-Scan App Environment Variables` note.

**Note:** If you run into problems like environment changes not being picked up, try clearing the cache ([more info](https://github.com/tusbar/babel-plugin-dotenv-import#caveats)). Alternatively, try `yarn start --clear` to start with a clear cache.

```bash
$ rm -rf node_modules/.cache/babel-loader/*
```

### Installing dependencies

```bash
Expand Down Expand Up @@ -91,14 +85,14 @@ This is the entry point to the app. It's the main component which renders the re

The GitHub Actions workflows can be found inside the `.github/workflows` directory.

### Master - `master.yml`
### EAS Update - `eas-update.yml`

For every commit made to the `master` branch it will build a JavaScript bundle that is then published to the dev app on Expo.

## Build and upload native app to Apple Connect and TestFlight
## EAS Build & Submit - `eas-build-and-submit.yml`

We use workflows in GitHub Actions to build and upload IPA packages to Apple Connect. These workflows are triggered manually from the [Actions tab](https://github.com/prototypsthlm/marine-plastic-app/actions). Select the workflow you want to run and then click the "Run workflow" dropdown on the right and choose which branch to base it off.
We only need to build if there is some changes to the native part of the app. If we only changing javascript code, it would update over the air with `EAS Update`.

Available actions:
EAS Build will build the .ipa and .apk and EAS Submit will publish them into the respective app stores.

- Upload native master build to TestFlight - `upload-master-ios.yml`
To trigger this action, we need to bump the versions in package.json & app.json and then create a github release.
6 changes: 5 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"backgroundColor": "#2C3339"
},
"updates": {
"fallbackToCacheTimeout": 0
"fallbackToCacheTimeout": 0,
"url": "https://u.expo.dev/c0a1e426-7056-416f-b872-fe40e170cf15"
},
"assetBundlePatterns": [
"**/*"
Expand Down Expand Up @@ -57,6 +58,9 @@
"eas": {
"projectId": "c0a1e426-7056-416f-b872-fe40e170cf15"
}
},
"runtimeVersion": {
"policy": "appVersion"
}
}
}
14 changes: 1 addition & 13 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@ module.exports = function (api) {
api.cache(true);
return {
presets: ["babel-preset-expo"],
plugins: [
[
"dotenv-import",
{
moduleName: "@env",
path: ".env",
blacklist: null,
whitelist: null,
safe: false,
allowUndefined: true,
},
],
],
plugins: [],
};
};
32 changes: 3 additions & 29 deletions eas.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,8 @@
{
"cli": {
"version": ">= 0.56.0"
"version": ">= 5.9.1"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal",
"env": {
"API_URL": "https://api-test.oceanscan.org/api/dca-v0",
"API_KEY": "***REMOVED***",
"AUTH_DOMAIN": "***REMOVED***",
"DATABASE_URL": "***REMOVED***",
"PROJECT_ID": "***REMOVED***",
"STORAGE_BUCKET": "***REMOVED***.appspot.com",
"MESSAGE_SENDER_ID": "***REMOVED***",
"APP_ID": "1:***REMOVED***:web:***REMOVED***"
}
},
"preview": {
"distribution": "internal",
"env": {
"API_URL": "https://api-test.oceanscan.org/api/dca-v0",
"API_KEY": "***REMOVED***",
"AUTH_DOMAIN": "***REMOVED***",
"DATABASE_URL": "***REMOVED***",
"PROJECT_ID": "***REMOVED***",
"STORAGE_BUCKET": "***REMOVED***.appspot.com",
"MESSAGE_SENDER_ID": "***REMOVED***",
"APP_ID": "1:***REMOVED***:web:***REMOVED***"
}
},
"production": {
"env": {
"API_URL": "https://api.oceanscan.org/api/dca-v0",
Expand All @@ -40,7 +13,8 @@
"STORAGE_BUCKET": "***REMOVED***.appspot.com",
"MESSAGE_SENDER_ID": "***REMOVED***",
"APP_ID": "1:***REMOVED***:web:***REMOVED***"
}
},
"channel": "production"
}
},
"submit": {
Expand Down
12 changes: 0 additions & 12 deletions env.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
"@types/styled-components-react-native": "^5.1.0",
"@types/uuid": "^8.3.0",
"@types/yup": "^0.29.11",
"babel-plugin-dotenv-import": "^2.1.0",
"jest-expo": "~49.0.0",
"metro-react-native-babel-preset": "^0.77.0",
"react-devtools": "^4.22.0",
Expand Down
Loading

0 comments on commit 4871a6d

Please sign in to comment.