Skip to content

Commit

Permalink
Merge pull request #48 from prototypsthlm/dev
Browse files Browse the repository at this point in the history
Production release 1.0.15
  • Loading branch information
simonkropp authored Dec 7, 2023
2 parents 4468a90 + e2dfec6 commit 1179d40
Show file tree
Hide file tree
Showing 30 changed files with 4,750 additions and 7,835 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.

2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
18
18 changes: 10 additions & 8 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
import React from "react";
import React, { useEffect } from "react";
import Main from "./src/Main";
import * as SplashScreen from "expo-splash-screen";
import AppLoading from "expo-app-loading";

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

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

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

if (!isLoadingComplete || !isUpdated) {
return <AppLoading />;
useEffect(() => {
if (isLoadingComplete) {
SplashScreen.hideAsync();
}
}, [isLoadingComplete]);

if (!isLoadingComplete) {
return null;
}

return <Main />;
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.
14 changes: 8 additions & 6 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Ocean Scan",
"slug": "ocean-scan",
"owner": "prototypsthlm",
"version": "1.0.14",
"version": "1.0.15",
"orientation": "portrait",
"icon": "./src/assets/images/icon.png",
"scheme": "oceanscan",
Expand All @@ -14,15 +14,14 @@
"backgroundColor": "#2C3339"
},
"updates": {
"fallbackToCacheTimeout": 0
"fallbackToCacheTimeout": 0,
"url": "https://u.expo.dev/c0a1e426-7056-416f-b872-fe40e170cf15"
},
"assetBundlePatterns": [
"**/*"
],
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "se.prototyp.oceanscanapp",
"buildNumber": "1.0.14",
"buildNumber": "1.0.15",
"infoPlist": {
"NSCameraUsageDescription": "Enable Camera access so that you can take pictures for the observation and extract the location and timestamp data",
"NSLocationWhenInUseUsageDescription": "Enable Location to use in case the photo provided doesn't have location data",
Expand Down Expand Up @@ -57,6 +56,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: [],
};
};
39 changes: 2 additions & 37 deletions eas.json
Original file line number Diff line number Diff line change
@@ -1,41 +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***"
},
"ios": {
"image": "macos-monterey-12.4-xcode-13.4"
}
},
"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***"
},
"ios": {
"image": "macos-monterey-12.4-xcode-13.4"
}
},
"production": {
"env": {
"API_URL": "https://api.oceanscan.org/api/dca-v0",
Expand All @@ -47,9 +14,7 @@
"MESSAGE_SENDER_ID": "***REMOVED***",
"APP_ID": "1:***REMOVED***:web:***REMOVED***"
},
"ios": {
"image": "macos-monterey-12.4-xcode-13.4"
}
"channel": "production"
}
},
"submit": {
Expand Down
Loading

0 comments on commit 1179d40

Please sign in to comment.