From 04936766df3256af929315807f8fa8269995398e Mon Sep 17 00:00:00 2001 From: Damian Date: Tue, 26 Mar 2024 22:23:13 +0100 Subject: [PATCH 01/64] feat: expo upgrade --- .../.github/workflows/linting.yml | 4 ++-- .../clients/mobile/react-native/package.json | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/{{cookiecutter.project_slug}}/.github/workflows/linting.yml b/{{cookiecutter.project_slug}}/.github/workflows/linting.yml index c236a91ce..d6d8b88cd 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/linting.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/linting.yml @@ -62,10 +62,10 @@ jobs: run: npm install - name: 🆎 TypeCheck working-directory: ./mobile - run: npm run tslint + run: npm run lint:tslint - name: 🚧 ESLint working-directory: ./mobile - run: npm run eslint + run: npm run lint:eslint - name: 🎨 Prettier working-directory: ./mobile run: npm run format:check diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/package.json b/{{cookiecutter.project_slug}}/clients/mobile/react-native/package.json index fe71ee2a0..74cf77520 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/package.json +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/package.json @@ -21,8 +21,8 @@ "pub:web": "npx expo export:web && cd web-build && vercel --prod && cd ..", "format:check": "prettier --check ./src", "format:write": "prettier --write ./src", - "tslint": "tsc --skipLibCheck", - "eslint": "eslint --ext .js,.ts,.jsx,.tsx --max-warnings=0 src" + "lint:tslint": "tsc --skipLibCheck", + "lint:eslint": "eslint --ext .js,.ts,.jsx,.tsx --max-warnings=0 src" }, "dependencies": { "@react-native-async-storage/async-storage": "1.21.0", @@ -44,10 +44,10 @@ "axios": "^1.3.2", "date-fns": "^2.29.3", "eslint-plugin-flowtype": "^8.0.3", - "expo": "^50.0.6", + "expo": "^50.0.14", "expo-application": "~5.8.3", "expo-build-properties": "~0.11.1", - "expo-dev-client": "~3.3.8", + "expo-dev-client": "~3.3.11", "expo-device": "~5.9.3", "expo-font": "~11.10.2", "expo-linear-gradient": "~12.7.1", @@ -55,12 +55,12 @@ "expo-notifications": "~0.27.6", "expo-splash-screen": "~0.26.4", "expo-status-bar": "~1.11.1", - "expo-updates": "~0.24.10", + "expo-updates": "~0.24.12", "expo-web-browser": "~12.8.2", "nativewind": "^2.0.11", "react": "18.2.0", "react-dom": "18.2.0", - "react-native": "0.73.4", + "react-native": "0.73.6", "react-native-dotenv": "^3.4.8", "react-native-gesture-handler": "~2.14.0", "react-native-pager-view": "6.2.3", From c2a97106a5267c895588707187f331dba812a8c4 Mon Sep 17 00:00:00 2001 From: Damian Date: Wed, 27 Mar 2024 12:39:01 +0100 Subject: [PATCH 02/64] feat(mobile) env variables and Nativewind v4 --- .../clients/mobile/react-native/.env.example | 3 ++- .../clients/mobile/react-native/.eslintrc.js | 1 + .../clients/mobile/react-native/App.tsx | 1 + .../clients/mobile/react-native/Config.d.ts | 1 + .../clients/mobile/react-native/Config.js | 27 ++++++------------- .../mobile/react-native/babel.config.js | 21 +-------------- .../clients/mobile/react-native/global.css | 3 +++ .../clients/mobile/react-native/global.d.ts | 11 +++++++- .../clients/mobile/react-native/package.json | 4 +-- .../react-native/src/components/styled.tsx | 23 ++++------------ .../react-native/src/screens/auth/login.tsx | 18 ++++--------- .../react-native/src/screens/auth/sign-up.tsx | 17 ++++-------- .../mobile/react-native/tailwind.config.js | 1 + 13 files changed, 45 insertions(+), 86 deletions(-) create mode 100644 {{cookiecutter.project_slug}}/clients/mobile/react-native/global.css diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/.env.example b/{{cookiecutter.project_slug}}/clients/mobile/react-native/.env.example index 5ad04d4d0..004f0b061 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/.env.example +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/.env.example @@ -3,4 +3,5 @@ # You can use this file to override them by prefixing with `EXPO_PUBLIC_` # EXPO_PUBLIC_BACKEND_SERVER_URL="https://{{ cookiecutter.project_slug }}-staging.herokuapp.com" - +# EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN='' +# EXPO_PUBLIC_SENTRY_DSN="" diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/.eslintrc.js b/{{cookiecutter.project_slug}}/clients/mobile/react-native/.eslintrc.js index 292c7e14c..cf30932f9 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/.eslintrc.js +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/.eslintrc.js @@ -12,4 +12,5 @@ module.exports = { 'react/react-in-jsx-scope': 'off', '@typescript-eslint/no-unused-vars': 'warn', }, + ignorePatterns: ['tailwind.config.js', 'metro.config.js'], } diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/App.tsx b/{{cookiecutter.project_slug}}/clients/mobile/react-native/App.tsx index 400685275..af7520cb2 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/App.tsx +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/App.tsx @@ -13,6 +13,7 @@ import React, { useCallback, useEffect, useState } from 'react' import { flushSync } from 'react-dom' import { LogBox, StyleSheet } from 'react-native' import { GestureHandlerRootView } from 'react-native-gesture-handler' +import './global.css' LogBox.ignoreLogs(['Require']) diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/Config.d.ts b/{{cookiecutter.project_slug}}/clients/mobile/react-native/Config.d.ts index 25b1dded7..369f9bca2 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/Config.d.ts +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/Config.d.ts @@ -4,6 +4,7 @@ declare const Config: { backendServerUrl: string logger: Logger['logger'] sentryDSN: string + isExpoGo?: boolean } export default Config diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/Config.js b/{{cookiecutter.project_slug}}/clients/mobile/react-native/Config.js index 39b8378b8..65194934f 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/Config.js +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/Config.js @@ -1,47 +1,36 @@ -import Logger from './logger' -import { Platform } from 'react-native' import Constants, { ExecutionEnvironment } from 'expo-constants' +import { Platform } from 'react-native' +import Logger from './logger' const BACKEND_SERVER_URL = process.env.EXPO_PUBLIC_BACKEND_SERVER_URL const SENTRY_DSN = process.env.EXPO_PUBLIC_SENTRY_DSN const ROLLBAR_ACCESS_TOKEN = process.env.EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN - -const { - backendServerUrl, - rollbarAccessToken, - sentryDSN, -} = Constants?.expoConfig?.extra +const { backendServerUrl, rollbarAccessToken, sentryDSN } = Constants?.expoConfig?.extra const isExpoGo = Constants.executionEnvironment === ExecutionEnvironment.StoreClient const isAndroid = Platform.OS === 'android' - const ENV = () => { - - - if(!isExpoGo){ - let rollbarToken = isAndroid ? undefined : rollbarAccessToken + if (!isExpoGo) { + let rollbarToken = isAndroid ? undefined : rollbarAccessToken const logger = new Logger(rollbarToken).logger return { backendServerUrl, logger, sentryDSN, - } - } - let rollbarToken = isAndroid ? undefined : ROLLBAR_ACCESS_TOKEN + let rollbarToken = isAndroid ? undefined : ROLLBAR_ACCESS_TOKEN const logger = new Logger(rollbarToken).logger return { backendServerUrl: BACKEND_SERVER_URL, logger, sentryDSN: SENTRY_DSN, + isExpoGo, } } const Config = { ...ENV() } -Config.logger.info('Config', JSON.stringify(Config, null, 2)) - -export default Config +export default Config \ No newline at end of file diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/babel.config.js b/{{cookiecutter.project_slug}}/clients/mobile/react-native/babel.config.js index 1887557ba..f408a1cba 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/babel.config.js +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/babel.config.js @@ -1,25 +1,6 @@ module.exports = function (api) { api.cache(true) return { - presets: ['babel-preset-expo'], - plugins: [ - 'react-native-reanimated/plugin', - 'nativewind/babel', - [ - 'module-resolver', - { - alias: { - '@components': './src/components', - '@screens': './src/screens', - '@stores': './src/stores', - '@assets': './assets', - '@services': './src/services', - '@utils': './src/utils', - '@src': './src', - }, - extensions: ['.js', '.jsx', '.ts', '.tsx'], - }, - ], - ], + presets: [['babel-preset-expo', { jsxImportSource: 'nativewind' }], 'nativewind/babel'], } } diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/global.css b/{{cookiecutter.project_slug}}/clients/mobile/react-native/global.css new file mode 100644 index 000000000..b5c61c956 --- /dev/null +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/global.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/global.d.ts b/{{cookiecutter.project_slug}}/clients/mobile/react-native/global.d.ts index fbca8c7ea..d908b7b83 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/global.d.ts +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/global.d.ts @@ -1 +1,10 @@ -/// \ No newline at end of file +/// + + +import { BounceableProps } from 'rn-bounceable' +declare global { + // Extend the existing BounceableProps type + export interface ExtendedBounceableProps extends BounceableProps { + contentContainerClassName?: string + } +} \ No newline at end of file diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/package.json b/{{cookiecutter.project_slug}}/clients/mobile/react-native/package.json index df921d67f..5fb8f0442 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/package.json +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/package.json @@ -57,7 +57,7 @@ "expo-status-bar": "~1.11.1", "expo-updates": "~0.24.12", "expo-web-browser": "~12.8.2", - "nativewind": "^2.0.11", + "nativewind": "^4.0.36", "react": "18.2.0", "react-dom": "18.2.0", "react-native": "0.73.6", @@ -95,8 +95,8 @@ "eslint-config-prettier": "^8.6.0", "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-react-native": "^4.1.0", + "tailwindcss": "^3.4.1", "prettier": "^2.7.1", - "tailwindcss": "3.3.0", "typescript": "^5.3.3" }, "resolutions": { diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/src/components/styled.tsx b/{{cookiecutter.project_slug}}/clients/mobile/react-native/src/components/styled.tsx index 3347e1bc8..d43cb4103 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/src/components/styled.tsx +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/src/components/styled.tsx @@ -1,22 +1,9 @@ -import { styled } from 'nativewind' -import { KeyboardAvoidingView, ScrollView } from 'react-native' +import { cssInterop } from 'nativewind' +import type { FC } from 'react' import { Bounceable } from 'rn-bounceable' -export const ScrollViewWind = styled(ScrollView, { - props: { - contentContainerStyle: true, - }, +cssInterop(Bounceable, { + contentContainerClassName: 'contentContainerStyle', }) -export const BounceableWind = styled(Bounceable, { - props: { - contentContainerStyle: true, - }, -}) - -export const KeyboardAvoidingViewWind = styled(KeyboardAvoidingView, { - props: { - style: true, - contentContainerStyle: true, - }, -}) +export const BounceableWind = Bounceable as FC diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/src/screens/auth/login.tsx b/{{cookiecutter.project_slug}}/clients/mobile/react-native/src/screens/auth/login.tsx index 6b872e4f2..c56be3f4a 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/src/screens/auth/login.tsx +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/src/screens/auth/login.tsx @@ -1,21 +1,13 @@ import { MultiPlatformSafeAreaView } from '@components/multi-platform-safe-area-view' -import { ScrollViewWind } from '@components/styled' +import { BounceableWind } from '@components/styled' import { Text } from '@components/text' import { TextFormField } from '@components/text-form-field' import { LoginForm, LoginFormInputs, TLoginForm, userApi } from '@services/user' import { useAuth } from '@stores/auth' import { FormProvider, useTnForm } from '@thinknimble/tn-forms-react' -import { styled } from 'nativewind' -import { View } from 'react-native' -import { Bounceable } from 'rn-bounceable' +import { ScrollView, View } from 'react-native' import { getNavio } from '../routes' -const BounceableWind = styled(Bounceable, { - props: { - contentContainerStyle: true, - }, -}) - const LoginInner = () => { const { form, overrideForm } = useTnForm() const { changeToken, changeUserId } = useAuth.use.actions() @@ -46,12 +38,12 @@ const LoginInner = () => { Log in - + - + diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/src/screens/auth/sign-up.tsx b/{{cookiecutter.project_slug}}/clients/mobile/react-native/src/screens/auth/sign-up.tsx index 5fcf7afe2..afa393d18 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/src/screens/auth/sign-up.tsx +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/src/screens/auth/sign-up.tsx @@ -1,5 +1,5 @@ import { MultiPlatformSafeAreaView } from '@components/multi-platform-safe-area-view' -import { ScrollViewWind } from '@components/styled' +import { BounceableWind } from '@components/styled' import { Text } from '@components/text' import { TextFormField } from '@components/text-form-field' import { userApi } from '@services/user' @@ -8,16 +8,9 @@ import { useAuth } from '@stores/auth' import { useMutation } from '@tanstack/react-query' import { MustMatchValidator } from '@thinknimble/tn-forms' import { FormProvider, useTnForm } from '@thinknimble/tn-forms-react' -import { styled } from 'nativewind' -import { View } from 'react-native' -import { Bounceable } from 'rn-bounceable' +import { ScrollView, View } from 'react-native' import { getNavio } from '../routes' -const BounceableWind = styled(Bounceable, { - props: { - contentContainerStyle: true, - }, -}) const InnerForm = () => { //TODO: match bootstrapper style for signup and hit backend @@ -59,14 +52,14 @@ const InnerForm = () => { Sign up - + - - + + Sign Up diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/tailwind.config.js b/{{cookiecutter.project_slug}}/clients/mobile/react-native/tailwind.config.js index 4b05569cb..ba1936f6f 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/tailwind.config.js +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/tailwind.config.js @@ -2,6 +2,7 @@ module.exports = { content: ['./App.{js,jsx,ts,tsx}', './src/**/*.{js,jsx,ts,tsx}'], + presets: [require('nativewind/preset')], theme: { extend: { colors: { From c53d665100b1506b00a73252f5e5b0b752c335e6 Mon Sep 17 00:00:00 2001 From: Damian Date: Wed, 27 Mar 2024 12:58:26 +0100 Subject: [PATCH 03/64] chore(mobile) deprecate sentry-expo in favor of @sentry/react-native --- .../clients/mobile/react-native/App.tsx | 5 +-- .../clients/mobile/react-native/app.config.js | 33 +++++-------------- .../clients/mobile/react-native/package.json | 3 +- .../mobile/react-native/src/utils/sentry.ts | 5 ++- 4 files changed, 15 insertions(+), 31 deletions(-) diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/App.tsx b/{{cookiecutter.project_slug}}/clients/mobile/react-native/App.tsx index af7520cb2..eb4910bda 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/App.tsx +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/App.tsx @@ -1,4 +1,5 @@ import { AppRoot } from '@screens/routes' +import * as Sentry from '@sentry/react-native' import { useAuth } from '@stores/auth' import { QueryClientProvider } from '@tanstack/react-query' import { customFonts } from '@utils/fonts' @@ -35,7 +36,7 @@ const styles = StyleSheet.create({ SplashScreen.preventAutoHideAsync() -export default (): JSX.Element => { +export default Sentry.wrap((): JSX.Element => { const [ready, setReady] = useState(false) const hasLocalStorageHydratedState = useAuth.use.hasHydrated() @@ -61,4 +62,4 @@ export default (): JSX.Element => { ) -} +}) diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/app.config.js b/{{cookiecutter.project_slug}}/clients/mobile/react-native/app.config.js index 0f1974f32..bab869d2c 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/app.config.js +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/app.config.js @@ -17,33 +17,18 @@ module.exports = { fallbackToCacheTimeout: 0, url: 'https://u.expo.dev/', // uuid of app }, - plugins: ['sentry-expo', 'expo-build-properties', 'expo-localization', 'expo-font'], - hooks: { - postPublish: [ + plugins: [ + [ + '@sentry/react-native/expo', { - // this set up assumes you are using one application with multiple projects in sentry - file: 'sentry-expo/upload-sourcemaps', - config: { - organization: '', // replace with org in sentry - project: process.env.SENTRY_PROJECT_NAME, // see readme for this variables - /** - * TL;DR This variable is mentioned here for documentation and not required to be explicitly set - * - * This variable is retrieved from the global environment variables available at build time - * It is not required to be explicitly set here, - * uncommenting this line results in warnings from expo - * These warnings can be safely ignored - * If building locally you can pass the variable in the build command - * - * source .env && SENTRY_PROJECT=${SENTRY_PROJECT_NAME}\ - * SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN} expo prebuild - * - */ - // authToken: process.env.SENTRY_AUTH_TOKEN, - }, + organization: '', // replace with org in sentry + project: process.env.SENTRY_PROJECT_NAME, // see readme for these variables }, ], - }, + 'expo-build-properties', + 'expo-localization', + 'expo-font', + ], ios: { supportsTablet: true, bundleIdentifier: '', // CHANGE TO BUNDLE ID diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/package.json b/{{cookiecutter.project_slug}}/clients/mobile/react-native/package.json index 5fb8f0442..6c6ec8009 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/package.json +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/package.json @@ -35,7 +35,7 @@ "@react-navigation/native-stack": "^6.9.0", "@react-navigation/stack": "^6.3.0", "@react-spring/native": "^9.7.3", - "@sentry/react-native": "5.17.0", + "@sentry/react-native": "5.19.1", "@shopify/flash-list": "1.6.3", "@tanstack/react-query": "^5.15.0", "@thinknimble/tn-forms": "^3.1.3", @@ -72,7 +72,6 @@ "rn-bounceable": "^1.2.0", "rn-navio": "0.0.6", "rollbar-react-native": "^0.9.3", - "sentry-expo": "~7.1.0", "zod": "3.21.4", "zustand": "^4.3.3" }, diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/src/utils/sentry.ts b/{{cookiecutter.project_slug}}/clients/mobile/react-native/src/utils/sentry.ts index ea27fe80c..9b7eb0a4f 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/src/utils/sentry.ts +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/src/utils/sentry.ts @@ -1,12 +1,11 @@ -import * as Sentry from 'sentry-expo' +import * as Sentry from '@sentry/react-native' import Config from '../../Config' export const initSentry = () => { Sentry.init({ dsn: Config.sentryDSN, - enableInExpoDevelopment: true, debug: true, // If `true`, Sentry will try to print out useful debugging information if something goes wrong with sending the event. Set it to `false` in production }) - Sentry.Native.captureException('Sentry Exception') + Sentry.captureException('Sentry Exception') } From 1de7c9698ca4d4189d814784d0eb3d71f1045ae1 Mon Sep 17 00:00:00 2001 From: Damian Date: Wed, 27 Mar 2024 18:14:50 +0100 Subject: [PATCH 04/64] chore: add metro config and unignore --- .../clients/mobile/react-native/.gitignore | 1 - .../clients/mobile/react-native/metro.config.js | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 {{cookiecutter.project_slug}}/clients/mobile/react-native/metro.config.js diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/.gitignore b/{{cookiecutter.project_slug}}/clients/mobile/react-native/.gitignore index 1fa45a63a..ca8bbaf1f 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/.gitignore +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/.gitignore @@ -22,7 +22,6 @@ media/ # will be generated after `expo run:ios` or `expo run:android` ios/ android/ -metro.config.js react-native.config.js index.js diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/metro.config.js b/{{cookiecutter.project_slug}}/clients/mobile/react-native/metro.config.js new file mode 100644 index 000000000..6692ed959 --- /dev/null +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/metro.config.js @@ -0,0 +1,6 @@ +const { getSentryExpoConfig } = require('@sentry/react-native/metro') +const { withNativeWind } = require('nativewind/metro') + +const config = getSentryExpoConfig(__dirname, { isCSSEnabled: true }) + +module.exports = withNativeWind(config, { input: './global.css' }) From eebe3203fa59b7daad701542490f18479303cc38 Mon Sep 17 00:00:00 2001 From: Pari Baker Date: Wed, 29 May 2024 18:41:08 -0700 Subject: [PATCH 05/64] update the bootstrapper pipeline to force the use of a new config --- .github/workflows/cypress.yml | 80 +------------- .github/workflows/mobile.yml | 104 ++++++++++++++++++ .vscode/launch.json | 17 +++ resources/app-bs.config.js | 66 ----------- resources/app-config-js-values.txt | 8 ++ resources/eas-bs.json | 45 -------- resources/eas-json-values.txt | 17 +++ scripts/vue_or_react.sh | 2 +- .../.github/workflows/expo-main.yml | 4 +- .../.github/workflows/expo-pr.yml | 6 +- .../clients/mobile/react-native/eas.json | 6 +- .../resources/app-config-js-values.txt | 8 ++ .../resources/eas-json-values.txt | 16 +++ .../scripts/setup_mobile_config.sh | 34 ++++++ 14 files changed, 214 insertions(+), 199 deletions(-) create mode 100644 .github/workflows/mobile.yml create mode 100644 .vscode/launch.json delete mode 100644 resources/app-bs.config.js create mode 100644 resources/app-config-js-values.txt delete mode 100644 resources/eas-bs.json create mode 100644 resources/eas-json-values.txt create mode 100644 {{cookiecutter.project_slug}}/resources/app-config-js-values.txt create mode 100644 {{cookiecutter.project_slug}}/resources/eas-json-values.txt create mode 100644 {{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index a5dc7c6bf..06fd3f56a 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -83,82 +83,4 @@ jobs: NPM_CONFIG_PRODUCTION: false CYPRESS_TEST_USER_EMAIL: "cypress@example.com" CYPRESS_TEST_USER_PASS: ${{ secrets.CYPRESS_TEST_USER_PASS }} - CYPRESS_baseUrl: ${{ github.event.deployment_status.environment_url }} - - configuremobile: - needs: Setup - runs-on: ubuntu-latest - outputs: - BUILD_MOBILE_APP: ${{ steps.checkdiff.outputs.BUILD_MOBILE_APP }} - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 5 - name: check diff - - id: checkdiff - run: | - git fetch origin main - echo $(git diff --name-only origin/main -- | grep "/clients/mobile/react-native/" | wc -l) - echo "BUILD_MOBILE_APP=$(git diff --name-only origin/main -- | grep "/clients/mobile/react-native/" | wc -l)" >> $GITHUB_OUTPUT - - getprnumber: - runs-on: ubuntu-latest - needs: configuremobile - if: needs.configuremobile.outputs.BUILD_MOBILE_APP != 0 - steps: - - uses: jwalton/gh-find-current-pr@master - id: findPr - - name: Set name for PR - if: success() && steps.findPr.outputs.number - run: echo "PR=pr-${PR}" >> $GITHUB_ENV - env: - PR: ${{ steps.findPr.outputs.pr }} - outputs: - PR: ${{ env.PR }} - - publish: - runs-on: ubuntu-latest - needs: getprnumber - steps: - - uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 - with: - name: my_project - path: my_project/ - - uses: actions/cache@v4 - with: - path: "**/node_modules" - key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} - - name: 🏗 Setup Node - uses: actions/setup-node@v4 - with: - node-version: 18.x - - - name: 🏗 Setup Expo and EAS - uses: expo/expo-github-action@v7 - with: - expo-version: latest - eas-version: latest - token: ${{ secrets.EXPO_TOKEN }} - - - name: 📦 Install dependencies - working-directory: ./my_project/mobile - run: yarn install - - - name: Copy Config files - run: | - ls - cp resources/app-bs.config.js my_project/mobile/app.config.js - cp resources/eas-bs.json my_project/mobile/eas.json - - - name: 🚀 Publish preview - working-directory: ./my_project/mobile - run: | - eas update --branch="${{ needs.getprnumber.outputs.PR }}" --non-interactive --auto - echo "${{ env.BACKEND_SERVER_URL }} and ${{ needs.getprnumber.outputs.PR }}" - env: - BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}" - ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7" - SENTRY_PROJECT_NAME: "tn-staging" - SENTRY_DSN: "https://a7cea97f07ac42fa9e28800b037997c9@o4504899535962112.ingest.sentry.io/4504906332897280" - SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}" + CYPRESS_baseUrl: ${{ github.event.deployment_status.environment_url }} \ No newline at end of file diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml new file mode 100644 index 000000000..17bdffa8c --- /dev/null +++ b/.github/workflows/mobile.yml @@ -0,0 +1,104 @@ +name: Mobile Deployment +on: [deployment_status] + +jobs: + # TODO move this to a common file + Setup: + if: github.event.deployment_status.state == 'success' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: pipx install pipenv + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + # Can't use cache because of https://github.com/actions/cache/issues/319 + # cache: 'pipenv' + - name: Install bootstrapper dependencies + run: pipenv install --dev --deploy + - run: | + config_file=$(./scripts/vue_or_react.sh) + pipenv run cookiecutter . --config-file $config_file --no-input -f + cat $config_file + - uses: actions/upload-artifact@v4 + with: + name: my_project + path: my_project/ + retention-days: 1 + configuremobile: + needs: Setup + runs-on: ubuntu-latest + outputs: + BUILD_MOBILE_APP: ${{ steps.checkdiff.outputs.BUILD_MOBILE_APP }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 5 + name: check diff + - id: checkdiff + run: | + git fetch origin main + echo $(git diff --name-only origin/main -- | grep "/clients/mobile/react-native/" | wc -l) + echo "BUILD_MOBILE_APP=$(git diff --name-only origin/main -- | grep "/clients/mobile/react-native/" | wc -l)" >> $GITHUB_OUTPUT + + getprnumber: + runs-on: ubuntu-latest + needs: configuremobile + if: needs.configuremobile.outputs.BUILD_MOBILE_APP != 0 + steps: + - uses: jwalton/gh-find-current-pr@master + id: findPr + - name: Set name for PR + if: success() && steps.findPr.outputs.number + run: echo "PR=pr-${PR}" >> $GITHUB_ENV + env: + PR: ${{ steps.findPr.outputs.pr }} + outputs: + PR: ${{ env.PR }} + + publish: + runs-on: ubuntu-latest + needs: getprnumber + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: my_project + path: my_project/ + - uses: actions/cache@v4 + with: + path: "**/node_modules" + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + - name: 🏗 Setup Node + uses: actions/setup-node@v4 + with: + node-version: 18.x + + - name: 🏗 Setup Expo and EAS + uses: expo/expo-github-action@v7 + with: + expo-version: latest + eas-version: latest + token: ${{ secrets.EXPO_TOKEN }} + + - name: 📦 Install dependencies + working-directory: ./my_project/mobile + run: yarn install + + - name: Create config files + run: | + ls + cp resources/app-bs.config.js my_project/mobile/app.config.js + cp resources/eas-bs.json my_project/mobile/eas.json + + - name: 🚀 Publish preview + working-directory: ./my_project/mobile + run: | + eas update --branch="${{ needs.getprnumber.outputs.PR }}" --non-interactive --auto + echo "${{ env.BACKEND_SERVER_URL }} and ${{ needs.getprnumber.outputs.PR }}" + env: + BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}" + ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7" + SENTRY_PROJECT_NAME: "tn-staging" + SENTRY_DSN: "https://a7cea97f07ac42fa9e28800b037997c9@o4504899535962112.ingest.sentry.io/4504906332897280" + SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}" diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..b93312356 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,17 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "zshdb", + "request": "launch", + "name": "Zsh-Debug (select script from list of sh files)", + "cwd": "${workspaceFolder}", + "program": "${command:SelectScriptName}", + "args": ["eas.json",".eas-json-values"] + }, + + ] +} \ No newline at end of file diff --git a/resources/app-bs.config.js b/resources/app-bs.config.js deleted file mode 100644 index 0fcef68b3..000000000 --- a/resources/app-bs.config.js +++ /dev/null @@ -1,66 +0,0 @@ -module.exports = { - expo: { - name: 'tn mobile bootstrapper', - slug: 'tn-sample-app', // should match expo - owner: 'thinknimble-bootstrapper', // should match expo - version: '1.0.0', - orientation: 'portrait', - icon: './assets/logo-sq.png', - userInterfaceStyle: 'automatic', - splash: { - image: './assets/splash.png', - resizeMode: 'contain', - backgroundColor: '#000000', - }, - assetBundlePatterns: ['**/*'], - updates: { - fallbackToCacheTimeout: 0, - url: 'https://u.expo.dev/ec1b86e2-2582-48cf-8a7a-c6d2772ba4f2', // uuid of app - }, - plugins: ['sentry-expo'], - hooks: { - postPublish: [ - { - // this set up assumes you are using one application with multiple projects in sentry - file: 'sentry-expo/upload-sourcemaps', - config: { - organization: 'tn-bootstrapper', - project: process.env.SENTRY_PROJECT_NAME, - authToken: process.env.SENTRY_AUTH_TOKEN, // defined in expo secrets - }, - }, - ], - }, - ios: { - supportsTablet: true, - bundleIdentifier: 'org.thinknimble.expo.bootstrapper', - config: { - usesNonExemptEncryption: false, - }, - }, - android: { - adaptiveIcon: { - foregroundImage: './assets/logo-sq.png', - backgroundColor: '#FFFFFF', - }, - package: 'com.example.app', - }, - web: { - favicon: './assets/logo-sq.png', - }, - extra: { - // these values are hardcoded and provided in eas.json - eas: { - projectId: 'ec1b86e2-2582-48cf-8a7a-c6d2772ba4f2', - }, - backendServerUrl: process.env.BACKEND_SERVER_URL, - buildEnv: process.env.BUILD_ENV, - rollbarAccessToken: process.env.ROLLBAR_ACCESS_TOKEN, - sentryDSN: process.env.SENTRY_DSN, - }, - runtimeVersion: { - policy: 'sdkVersion', - }, - }, - } - \ No newline at end of file diff --git a/resources/app-config-js-values.txt b/resources/app-config-js-values.txt new file mode 100644 index 000000000..f1d3456c0 --- /dev/null +++ b/resources/app-config-js-values.txt @@ -0,0 +1,8 @@ + +REPLACE_WITH_EXPO_APP_NAME=tn mobile bootstrapper +REPLACE_WITH_EXPO_APP_SLUG=tn-sample-app +REPLACE_WITH_EXPO_OWNER=thinknimble-bootstrapper +REPLACE_WITH_EXPO_APP_ID=ec1b86e2-2582-48cf-8a7a-c6d2772ba4f2 +REPLACE_WITH_SENTRY_ORG=tn-bootstrapper +REPLACE_WITH_IOS_BUNDLE_ID=org.thinknimble.expo.bootstrapper +REPLACE_WITH_ANDROID_PACKAGE_ID=com.example.app diff --git a/resources/eas-bs.json b/resources/eas-bs.json deleted file mode 100644 index ccb2daee3..000000000 --- a/resources/eas-bs.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "cli": { - "version": ">= 2.4.1", - "appVersionSource": "remote" - }, - "build": { - "development": { - "developmentClient": true, - "distribution": "internal", - "channel": "development" - }, - "staging": { - "distribution": "internal", - "channel": "staging", - "env": { - "BACKEND_SERVER_URL": "https://tn-spa-bootstrapper-production.herokuapp.com/", - "BUILD_ENV": "staging", - "ROLLBAR_ACCESS_TOKEN": "1a19e5da05b2435b802d5a81aba2bbd7", - "SENTRY_PROJECT_NAME": "tn-staging", - "SENTRY_DSN": "https://a7cea97f07ac42fa9e28800b037997c9@o4504899535962112.ingest.sentry.io/4504906332897280" - } - }, - "production": { - "channel": "production", - "autoIncrement": true, - "env": { - "BACKEND_SERVER_URL": "https://tn-spa-bootstrapper-staging.herokuapp.com/", - "BUILD_ENV": "production", - "ROLLBAR_ACCESS_TOKEN": "e6246274f1f2411990f0cd1c7b99b072", - "SENTRY_PROJECT_NAME": "tn-prod", - "SENTRY_DSN": "https://df747bb2e58d4f178f433f322bd41026@o4504899535962112.ingest.sentry.io/4504906701733888" - } - } - }, - "submit": { - "production": { - "ios": { - "appName": "TN Bootsrapper RN", - "appleId": "pari@thinknimble.com", - "appleTeamId": "6BNA6HFF6B", - "ascAppId": "12023" - } - } - } - } \ No newline at end of file diff --git a/resources/eas-json-values.txt b/resources/eas-json-values.txt new file mode 100644 index 000000000..c05a75736 --- /dev/null +++ b/resources/eas-json-values.txt @@ -0,0 +1,17 @@ +REPLACE_WITH_LOCAL_BACKEND_SERVER_URL=https://tn-spa-bootstrapper-production.herokuapp.com +REPLACE_WITH_STAGING_BACKEND_SERVER_URL=https://tn-spa-bootstrapper-production.herokuapp.com +REPLACE_WITH_PRODUCTION_BACKEND_SERVER_URL=https://tn-spa-bootstrapper-production.herokuapp.com +REPLACE_WITH_REVIEW_APP_BACKEND_SERVER_URL=https://tn-spa-bootstrapper-production.herokuapp.com +REPLACE_WITH_LOCAL_ROLLBAR_TOKEN=1a19e5da05b2435b802d5a81aba2bbd7 +REPLACE_WITH_STAGING_ROLLBAR_TOKEN=1a19e5da05b2435b802d5a81aba2bbd7 +REPLACE_WITH_PRODUCTION_ROLLBAR_TOKEN=1a19e5da05b2435b802d5a81aba2bbd7 +REPLACE_WITH_REVIEW_APP_ROLLBAR_TOKEN=1a19e5da05b2435b802d5a81aba2bbd7 +REPLACE_WITH_REVIEW_APP_SENTRY_DSN=https://a7cea97f07ac42fa9e28800b037997c9@o4504899535962112.ingest.sentry.io/4504906332897280 +REPLACE_WITH_LOCAL_SENTRY_DSN=https://a7cea97f07ac42fa9e28800b037997c9@o4504899535962112.ingest.sentry.io/4504906332897280 +REPLACE_WITH_STAGING_SENTRY_DSN=https://a7cea97f07ac42fa9e28800b037997c9@o4504899535962112.ingest.sentry.io/4504906332897280 +REPLACE_WITH_PRODUCTION_SENTRY_DSN=https://a7cea97f07ac42fa9e28800b037997c9@o4504899535962112.ingest.sentry.io/4504906332897280 +REPLACE_WITH_APPSTORE_CONNECT_APP_NAME=TN Bootsrapper RN +REPLACE_WITH_APPLE_ID_EMAIL_SIGNING_APP=pari@thinknimble.com +REPLACE_WITH_APPLESTORE_CONNECT_ID=test +REPLACE_WITH_APPLE_TEAM_ID=6BNA6HFF6B + diff --git a/scripts/vue_or_react.sh b/scripts/vue_or_react.sh index 7fc7c14c0..eb888ad7d 100755 --- a/scripts/vue_or_react.sh +++ b/scripts/vue_or_react.sh @@ -14,7 +14,7 @@ else fi if [ "$rn_count" != 0 ]; then - cp -r resources/ {{cookiecutter.project_slug}}/ + cp -r resources/ {{cookiecutter.project_slug}}/resources/ sed -i.bak 's/include_mobile: "n"/include_mobile: "y"/' $config_file_path fi diff --git a/{{cookiecutter.project_slug}}/.github/workflows/expo-main.yml b/{{cookiecutter.project_slug}}/.github/workflows/expo-main.yml index e04f4474a..c88a064cb 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/expo-main.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/expo-main.yml @@ -70,7 +70,7 @@ jobs: run: cd mobile && eas update --branch=staging --non-interactive --auto env: # Since expo update replaces code OTA these variables should match the staging variables in eas.json - BACKEND_SERVER_URL: "" - ROLLBAR_ACCESS_TOKEN: "" + EXPO_PUBLIC_BACKEND_SERVER_URL: "" + EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: "" diff --git a/{{cookiecutter.project_slug}}/.github/workflows/expo-pr.yml b/{{cookiecutter.project_slug}}/.github/workflows/expo-pr.yml index ac3c4cb0d..0e7f0a6b6 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/expo-pr.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/expo-pr.yml @@ -46,7 +46,7 @@ jobs: - name: 🚀 Publish preview run: | cd mobile && eas update --branch={{ "${{ needs.setup.outputs.PR }}" }} --non-interactive --auto - echo "{{ "${{ env.BACKEND_SERVER_URL }}" }} and {{ "${{ needs.setup.outputs.PR }}" }}" + echo "{{ "${{ env.EXPO_PUBLIC_BACKEND_SERVER_URL }}" }} and {{ "${{ needs.setup.outputs.PR }}" }}" env: - BACKEND_SERVER_URL: {{ "${{ github.event.deployment_status.environment_url }}" }} - ROLLBAR_ACCESS_TOKEN: "" + EXPO_PUBLIC_BACKEND_SERVER_URL: {{ "${{ github.event.deployment_status.environment_url }}" }} + EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: "" diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json b/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json index 552c464f8..0653c4a84 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json @@ -55,10 +55,10 @@ "channel": "production", "autoIncrement": true, "env": { - "BACKEND_SERVER_URL": "", + "BACKEND_SERVER_URL": "", "BUILD_ENV": "production", - "ROLLBAR_ACCESS_TOKEN": "", - "SENTRY_DSN": "" + "ROLLBAR_ACCESS_TOKEN": "", + "SENTRY_DSN": "" } } }, diff --git a/{{cookiecutter.project_slug}}/resources/app-config-js-values.txt b/{{cookiecutter.project_slug}}/resources/app-config-js-values.txt new file mode 100644 index 000000000..99bbfecbc --- /dev/null +++ b/{{cookiecutter.project_slug}}/resources/app-config-js-values.txt @@ -0,0 +1,8 @@ +REPLACE_WITH_EXPO_APP_NAME= +REPLACE_WITH__EXPO_APP_SLUG= +REPLACE_WITH_EXPO_OWNER= +REPLACE_WITH_EXPO_APP_ID= +REPLACE_WITH_SENTRY_ORG= +REPLACE_WITH_IOS_BUNDLE_ID= +REPLACE_WITH_ANDROID_PACKAGE_ID= +REPLACE_WITH_EXPO_APP_ID= \ No newline at end of file diff --git a/{{cookiecutter.project_slug}}/resources/eas-json-values.txt b/{{cookiecutter.project_slug}}/resources/eas-json-values.txt new file mode 100644 index 000000000..225945ab4 --- /dev/null +++ b/{{cookiecutter.project_slug}}/resources/eas-json-values.txt @@ -0,0 +1,16 @@ +REPLACE_WITH_LOCAL_BACKEND_SERVER_URL= +REPLACE_WITH_STAGING_BACKEND_SERVER_URL= +REPLACE_WITH_PRODUCTION_BACKEND_SERVER_URL= +REPLACE_WITH_REVIEW_APP_BACKEND_SERVER_URL= +REPLACE_WITH_LOCAL_ROLLBAR_TOKEN= +REPLACE_WITH_STAGING_ROLLBAR_TOKEN= +REPLACE_WITH_PRODUCTION_ROLLBAR_TOKEN= +REPLACE_WITH_REVIEW_APP_ROLLBAR_TOKEN= +REPLACE_WITH_REVIEW_APP_SENTRY_DSN= +REPLACE_WITH_LOCAL_SENTRY_DSN= +REPLACE_WITH_STAGING_SENTRY_DSN= +REPLACE_WITH_PRODUCTION_SENTRY_DSN= +REPLACE_WITH_APPSTORE_CONNECT_APP_NAME= +REPLACE_WITH_APPLE_ID_EMAIL_SIGNING_APP= +REPLACE_WITH_APPLE_TEAM_ID= +REPLACE_WITH_APPLESTORE_CONNECT_ID= diff --git a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh new file mode 100644 index 000000000..b8ac469c2 --- /dev/null +++ b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh @@ -0,0 +1,34 @@ +base_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +config_file=$base_dir/mobile/$1 + +defaults_file=$base_dir/resources/$2 + +cat $config_file +echo $defaults_file + +declare -a replace_with +declare -a merged_arr + +while IFS= read -r line; do + replace_with+=("$line") +done < <(grep -o "REPLACE_WITH_[A-Z_]*" "$config_file") + +while IFS= read -r line; do + merged_arr+=("$line") +done < <(grep -o "REPLACE_WITH_[A-Z_]*" "$defaults_file") + + +for i in "${replace_with[@]}"; do + # printf $i + # set the value equal to the value that matches the same name in the defaults file + value=$(grep -o "$i=.*" "$defaults_file") + value=${value#*=} + value=$(printf '%q' "$value") + # echo $i has value $value + if [[ -n $value ]]; then + # replace that name in the file with the value + sed -i.bak "s#<$i>#$value#g" "$config_file" + fi + +done \ No newline at end of file From 2821356d50a413a224137f9a6ee9330c4377b20c Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Mon, 12 Aug 2024 15:01:22 -0500 Subject: [PATCH 06/64] fix vars --- .github/workflows/mobile.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 17bdffa8c..073d10857 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -97,8 +97,5 @@ jobs: eas update --branch="${{ needs.getprnumber.outputs.PR }}" --non-interactive --auto echo "${{ env.BACKEND_SERVER_URL }} and ${{ needs.getprnumber.outputs.PR }}" env: - BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}" - ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7" - SENTRY_PROJECT_NAME: "tn-staging" - SENTRY_DSN: "https://a7cea97f07ac42fa9e28800b037997c9@o4504899535962112.ingest.sentry.io/4504906332897280" - SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}" + EXPO_PUBLIC_BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}" + EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7" \ No newline at end of file From f5edc9b322f842449c038df37efb7e427d146f47 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Mon, 12 Aug 2024 15:02:41 -0500 Subject: [PATCH 07/64] fix conflict --- .../clients/mobile/react-native/.env.example | 4 ---- 1 file changed, 4 deletions(-) diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/.env.example b/{{cookiecutter.project_slug}}/clients/mobile/react-native/.env.example index a945fcbf7..0780da3b3 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/.env.example +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/.env.example @@ -3,7 +3,3 @@ # EXPO_PUBLIC_BACKEND_SERVER_URL="https://{{ cookiecutter.project_slug }}-staging.herokuapp.com" # EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN='' -<<<<<<< HEAD -# EXPO_PUBLIC_SENTRY_DSN="" -======= ->>>>>>> main From bb3054ce53620e5b127efadb6b946c0c7e4e3f09 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Mon, 12 Aug 2024 16:56:38 -0500 Subject: [PATCH 08/64] updated the script to work from within the bs app --- resources/eas-json-values.txt | 2 +- .../clients/mobile/react-native/app.config.js | 16 ++++++++-------- .../clients/mobile/react-native/eas.json | 4 ++-- .../scripts/setup_mobile_config.sh | 5 ++--- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/resources/eas-json-values.txt b/resources/eas-json-values.txt index c05a75736..f0a9bcfad 100644 --- a/resources/eas-json-values.txt +++ b/resources/eas-json-values.txt @@ -12,6 +12,6 @@ REPLACE_WITH_STAGING_SENTRY_DSN=https://a7cea97f07ac42fa9e28800b037997c9@o450489 REPLACE_WITH_PRODUCTION_SENTRY_DSN=https://a7cea97f07ac42fa9e28800b037997c9@o4504899535962112.ingest.sentry.io/4504906332897280 REPLACE_WITH_APPSTORE_CONNECT_APP_NAME=TN Bootsrapper RN REPLACE_WITH_APPLE_ID_EMAIL_SIGNING_APP=pari@thinknimble.com -REPLACE_WITH_APPLESTORE_CONNECT_ID=test +REPLACE_WITH_APPLESTORE_CONNECT_ID=6446805695 REPLACE_WITH_APPLE_TEAM_ID=6BNA6HFF6B diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/app.config.js b/{{cookiecutter.project_slug}}/clients/mobile/react-native/app.config.js index bab869d2c..5b43d0695 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/app.config.js +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/app.config.js @@ -1,8 +1,8 @@ module.exports = { expo: { - name: '', - slug: '', - owner: '', + name: 'tn mobile bootstrapper', + slug: 'tn-sample-app', + owner: 'thinknimble-bootstrapper', version: '1.0.0', orientation: 'portrait', icon: './assets/logo-sq.png', @@ -15,13 +15,13 @@ module.exports = { assetBundlePatterns: ['**/*'], updates: { fallbackToCacheTimeout: 0, - url: 'https://u.expo.dev/', // uuid of app + url: 'https://u.expo.dev/ec1b86e2-2582-48cf-8a7a-c6d2772ba4f2', // uuid of app }, plugins: [ [ '@sentry/react-native/expo', { - organization: '', // replace with org in sentry + organization: 'tn-bootstrapper', // replace with org in sentry project: process.env.SENTRY_PROJECT_NAME, // see readme for these variables }, ], @@ -31,7 +31,7 @@ module.exports = { ], ios: { supportsTablet: true, - bundleIdentifier: '', // CHANGE TO BUNDLE ID + bundleIdentifier: 'org.thinknimble.expo.bootstrapper', // CHANGE TO BUNDLE ID config: { usesNonExemptEncryption: false, }, @@ -41,14 +41,14 @@ module.exports = { foregroundImage: './assets/logo-sq.png', backgroundColor: '#FFFFFF', }, - package: '', // CHANGE TO PACKAGE ID + package: 'com.example.app', // CHANGE TO PACKAGE ID }, web: { favicon: './assets/logo-sq.png', }, extra: { eas: { - projectId: '', // uuid of app + projectId: 'ec1b86e2-2582-48cf-8a7a-c6d2772ba4f2', // uuid of app }, // these values are hardcoded and provided in eas.json backendServerUrl: process.env.BACKEND_SERVER_URL, diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json b/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json index 0653c4a84..a3e9b4b25 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json @@ -67,8 +67,8 @@ "ios": { "appName": "", "appleId": "", - "appleTeamId": "", - "ascAppId": "", + "appleTeamId": "" } } } diff --git a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh index b8ac469c2..73d956b04 100644 --- a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh +++ b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh @@ -1,11 +1,10 @@ base_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - +# echo $base_dir config_file=$base_dir/mobile/$1 defaults_file=$base_dir/resources/$2 -cat $config_file -echo $defaults_file + declare -a replace_with declare -a merged_arr From ef6c7a18c6d0c0349f906c690c2d5a627c46e198 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Mon, 12 Aug 2024 17:03:02 -0500 Subject: [PATCH 09/64] cp files run script --- .github/workflows/mobile.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 073d10857..f6145a45f 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -44,7 +44,7 @@ jobs: getprnumber: runs-on: ubuntu-latest needs: configuremobile - if: needs.configuremobile.outputs.BUILD_MOBILE_APP != 0 + # if: needs.configuremobile.outputs.BUILD_MOBILE_APP != 0 steps: - uses: jwalton/gh-find-current-pr@master id: findPr @@ -88,8 +88,11 @@ jobs: - name: Create config files run: | ls - cp resources/app-bs.config.js my_project/mobile/app.config.js - cp resources/eas-bs.json my_project/mobile/eas.json + cp resources/app-config-js-values.txt my_project/mobile/app-config-js-values.txt + cp resources/eas-json-values.txt my_project/mobile/easjson-values.txt + . my_project/scripts/setup_mobile_config.sh app.config.js app-config-js-values.txt + . my_project/scripts/setup_mobile_config.sh eas.json eas-json-values.txt + - name: 🚀 Publish preview working-directory: ./my_project/mobile From e1bceb98550151ca1024d456fe9e7554c7d47eac Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Mon, 12 Aug 2024 17:13:01 -0500 Subject: [PATCH 10/64] fix directory issues --- .github/workflows/mobile.yml | 13 +++++++++---- .../scripts/setup_mobile_config.sh | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index f6145a45f..92050548b 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -1,5 +1,5 @@ name: Mobile Deployment -on: [deployment_status] +on: [deployment_status, workflow_dispatch] jobs: # TODO move this to a common file @@ -38,8 +38,13 @@ jobs: - id: checkdiff run: | git fetch origin main - echo $(git diff --name-only origin/main -- | grep "/clients/mobile/react-native/" | wc -l) - echo "BUILD_MOBILE_APP=$(git diff --name-only origin/main -- | grep "/clients/mobile/react-native/" | wc -l)" >> $GITHUB_OUTPUT + if [ {{ "${{ github.event_name }}" }} == "workflow_dispatch" ]; then + echo "This workflow was triggered by a workflow_dispatch event." + echo "BUILD_MOBILE_APP=1" >> $GITHUB_OUTPUT + else + echo $(git diff --name-only origin/main -- | grep "/clients/mobile/react-native/" | wc -l) + echo "BUILD_MOBILE_APP=$(git diff --name-only origin/main -- | grep "/clients/mobile/react-native/" | wc -l)" >> $GITHUB_OUTPUT + fi getprnumber: runs-on: ubuntu-latest @@ -92,7 +97,7 @@ jobs: cp resources/eas-json-values.txt my_project/mobile/easjson-values.txt . my_project/scripts/setup_mobile_config.sh app.config.js app-config-js-values.txt . my_project/scripts/setup_mobile_config.sh eas.json eas-json-values.txt - + - name: 🚀 Publish preview working-directory: ./my_project/mobile diff --git a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh index 73d956b04..96b195e0f 100644 --- a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh +++ b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh @@ -1,8 +1,8 @@ base_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # echo $base_dir -config_file=$base_dir/mobile/$1 +config_file=mobile/$1 -defaults_file=$base_dir/resources/$2 +defaults_file=resources/$2 From a4debde3a9448818a4a64219e86853517e759d77 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Mon, 12 Aug 2024 17:15:28 -0500 Subject: [PATCH 11/64] remove unnecessary step --- .github/workflows/mobile.yml | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 92050548b..7fb264e61 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -45,25 +45,10 @@ jobs: echo $(git diff --name-only origin/main -- | grep "/clients/mobile/react-native/" | wc -l) echo "BUILD_MOBILE_APP=$(git diff --name-only origin/main -- | grep "/clients/mobile/react-native/" | wc -l)" >> $GITHUB_OUTPUT fi - - getprnumber: - runs-on: ubuntu-latest - needs: configuremobile - # if: needs.configuremobile.outputs.BUILD_MOBILE_APP != 0 - steps: - - uses: jwalton/gh-find-current-pr@master - id: findPr - - name: Set name for PR - if: success() && steps.findPr.outputs.number - run: echo "PR=pr-${PR}" >> $GITHUB_ENV - env: - PR: ${{ steps.findPr.outputs.pr }} - outputs: - PR: ${{ env.PR }} - + + # if: needs.configuremobile.outputs.BUILD_MOBILE_APP != 0 publish: runs-on: ubuntu-latest - needs: getprnumber steps: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 @@ -102,8 +87,8 @@ jobs: - name: 🚀 Publish preview working-directory: ./my_project/mobile run: | - eas update --branch="${{ needs.getprnumber.outputs.PR }}" --non-interactive --auto - echo "${{ env.BACKEND_SERVER_URL }} and ${{ needs.getprnumber.outputs.PR }}" + eas update --branch="${{ github.event.deployment_status.environment_url }}" --non-interactive --auto + echo "${{ env.BACKEND_SERVER_URL }} and ${{ github.event.deployment_status.environment_url }}" env: EXPO_PUBLIC_BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}" EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7" \ No newline at end of file From 73b500268ff6996c588b9c56635e976d5012452e Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Mon, 12 Aug 2024 17:20:20 -0500 Subject: [PATCH 12/64] try new dir --- .github/workflows/mobile.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 7fb264e61..e63843105 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -80,6 +80,7 @@ jobs: ls cp resources/app-config-js-values.txt my_project/mobile/app-config-js-values.txt cp resources/eas-json-values.txt my_project/mobile/easjson-values.txt + cd my_project . my_project/scripts/setup_mobile_config.sh app.config.js app-config-js-values.txt . my_project/scripts/setup_mobile_config.sh eas.json eas-json-values.txt From c48b69b6249535ff1178f21f522059c8c0d74cc2 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Mon, 12 Aug 2024 17:26:54 -0500 Subject: [PATCH 13/64] try new dir --- .github/workflows/mobile.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index e63843105..6f9bd40bb 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -48,6 +48,7 @@ jobs: # if: needs.configuremobile.outputs.BUILD_MOBILE_APP != 0 publish: + needs: configuremobile runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -85,11 +86,11 @@ jobs: . my_project/scripts/setup_mobile_config.sh eas.json eas-json-values.txt - - name: 🚀 Publish preview - working-directory: ./my_project/mobile - run: | - eas update --branch="${{ github.event.deployment_status.environment_url }}" --non-interactive --auto - echo "${{ env.BACKEND_SERVER_URL }} and ${{ github.event.deployment_status.environment_url }}" - env: - EXPO_PUBLIC_BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}" - EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7" \ No newline at end of file + # - name: 🚀 Publish preview + # working-directory: ./my_project/mobile + # run: | + # eas update --branch="${{ github.event.deployment_status.environment_url }}" --non-interactive --auto + # echo "${{ env.BACKEND_SERVER_URL }} and ${{ github.event.deployment_status.environment_url }}" + # env: + # EXPO_PUBLIC_BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}" + # EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7" \ No newline at end of file From 4105a356fef7d02cee87e828c2d3b9296ac0e676 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Mon, 12 Aug 2024 17:32:48 -0500 Subject: [PATCH 14/64] fix dir after switch --- .github/workflows/mobile.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 6f9bd40bb..4e07d1b0a 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -82,8 +82,8 @@ jobs: cp resources/app-config-js-values.txt my_project/mobile/app-config-js-values.txt cp resources/eas-json-values.txt my_project/mobile/easjson-values.txt cd my_project - . my_project/scripts/setup_mobile_config.sh app.config.js app-config-js-values.txt - . my_project/scripts/setup_mobile_config.sh eas.json eas-json-values.txt + . scripts/setup_mobile_config.sh app.config.js app-config-js-values.txt + . scripts/setup_mobile_config.sh eas.json eas-json-values.txt # - name: 🚀 Publish preview From 870cae43bff177b501bb65bf079e6837521be710 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Mon, 12 Aug 2024 17:43:06 -0500 Subject: [PATCH 15/64] checking again --- .github/workflows/mobile.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 4e07d1b0a..cb947bfc4 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -81,6 +81,8 @@ jobs: ls cp resources/app-config-js-values.txt my_project/mobile/app-config-js-values.txt cp resources/eas-json-values.txt my_project/mobile/easjson-values.txt + echo "Ran cp command" + ls my_project/ cd my_project . scripts/setup_mobile_config.sh app.config.js app-config-js-values.txt . scripts/setup_mobile_config.sh eas.json eas-json-values.txt From 0b1117100ff2c8e77a3e63502dbc770f84123ec4 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Mon, 12 Aug 2024 17:56:29 -0500 Subject: [PATCH 16/64] attempt #2 --- .github/workflows/mobile.yml | 10 ++++++---- .../scripts/setup_mobile_config.sh | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index cb947bfc4..13705699c 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -46,7 +46,7 @@ jobs: echo "BUILD_MOBILE_APP=$(git diff --name-only origin/main -- | grep "/clients/mobile/react-native/" | wc -l)" >> $GITHUB_OUTPUT fi - # if: needs.configuremobile.outputs.BUILD_MOBILE_APP != 0 + publish: needs: configuremobile runs-on: ubuntu-latest @@ -79,11 +79,13 @@ jobs: - name: Create config files run: | ls - cp resources/app-config-js-values.txt my_project/mobile/app-config-js-values.txt - cp resources/eas-json-values.txt my_project/mobile/easjson-values.txt + cp resources/app-config-js-values.txt my_project/resources/app-config-js-values.txt + cp resources/eas-json-values.txt my_project/resources/easjson-values.txt echo "Ran cp command" - ls my_project/ cd my_project + echo "entered the directory" + chmod +x scripts/setup_mobile_config.sh + echo "ran chmod" . scripts/setup_mobile_config.sh app.config.js app-config-js-values.txt . scripts/setup_mobile_config.sh eas.json eas-json-values.txt diff --git a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh index 96b195e0f..34ac2c416 100644 --- a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh +++ b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh @@ -1,3 +1,5 @@ +#!/bin/bash + base_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # echo $base_dir config_file=mobile/$1 From 0d589058ce94abd7a50a7ac9c3a0ce81a3406b8e Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Mon, 12 Aug 2024 18:03:35 -0500 Subject: [PATCH 17/64] check if script is running --- {{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh index 34ac2c416..fc6c0c29b 100644 --- a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh +++ b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh @@ -1,4 +1,5 @@ #!/bin/bash +printf "begining replacement" base_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # echo $base_dir @@ -6,7 +7,8 @@ config_file=mobile/$1 defaults_file=resources/$2 - +printf $config_file +print $defaults_file declare -a replace_with declare -a merged_arr From f30419bde8b29f8e5440943d8e9c2d32b2f6991b Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Mon, 12 Aug 2024 18:09:33 -0500 Subject: [PATCH 18/64] trying to see error --- .github/workflows/mobile.yml | 1 + {{cookiecutter.project_slug}}/scripts/hello-world.sh | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 {{cookiecutter.project_slug}}/scripts/hello-world.sh diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 13705699c..673aee9c5 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -79,6 +79,7 @@ jobs: - name: Create config files run: | ls + . scripts/hell-world.sh cp resources/app-config-js-values.txt my_project/resources/app-config-js-values.txt cp resources/eas-json-values.txt my_project/resources/easjson-values.txt echo "Ran cp command" diff --git a/{{cookiecutter.project_slug}}/scripts/hello-world.sh b/{{cookiecutter.project_slug}}/scripts/hello-world.sh new file mode 100644 index 000000000..373d0526b --- /dev/null +++ b/{{cookiecutter.project_slug}}/scripts/hello-world.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +# This is a test +echo "Hello World" \ No newline at end of file From a956ec5ed778a3b915dfacd2cd9a0f7055fce35c Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Mon, 12 Aug 2024 18:18:05 -0500 Subject: [PATCH 19/64] utypo --- .github/workflows/mobile.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 673aee9c5..e8c979cef 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -79,7 +79,7 @@ jobs: - name: Create config files run: | ls - . scripts/hell-world.sh + . scripts/hello-world.sh cp resources/app-config-js-values.txt my_project/resources/app-config-js-values.txt cp resources/eas-json-values.txt my_project/resources/easjson-values.txt echo "Ran cp command" From 33dcde456509fc077b036a8351765ff808e209d0 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Mon, 12 Aug 2024 18:25:14 -0500 Subject: [PATCH 20/64] try and see output --- .github/workflows/mobile.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index e8c979cef..0308300d3 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -79,11 +79,11 @@ jobs: - name: Create config files run: | ls - . scripts/hello-world.sh cp resources/app-config-js-values.txt my_project/resources/app-config-js-values.txt cp resources/eas-json-values.txt my_project/resources/easjson-values.txt echo "Ran cp command" cd my_project + . scripts/hello-world.sh echo "entered the directory" chmod +x scripts/setup_mobile_config.sh echo "ran chmod" From f3a759f31c0777a51b1a23cb0b0d9dd044c16e87 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Mon, 12 Aug 2024 18:33:39 -0500 Subject: [PATCH 21/64] try logs --- .../scripts/setup_mobile_config.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh index fc6c0c29b..9401dca39 100644 --- a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh +++ b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh @@ -1,5 +1,5 @@ #!/bin/bash -printf "begining replacement" +echo "begining replacement" base_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # echo $base_dir @@ -7,8 +7,8 @@ config_file=mobile/$1 defaults_file=resources/$2 -printf $config_file -print $defaults_file +echo $config_file +echo $defaults_file declare -a replace_with declare -a merged_arr From 5f3c0b377f72c8bbafc9cf645a5a1f4d754d5b57 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Mon, 12 Aug 2024 19:42:31 -0500 Subject: [PATCH 22/64] check each var --- {{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh index 9401dca39..86b34ad28 100644 --- a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh +++ b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh @@ -7,8 +7,6 @@ config_file=mobile/$1 defaults_file=resources/$2 -echo $config_file -echo $defaults_file declare -a replace_with declare -a merged_arr @@ -33,5 +31,5 @@ for i in "${replace_with[@]}"; do # replace that name in the file with the value sed -i.bak "s#<$i>#$value#g" "$config_file" fi - + echo "Done replacing $i" done \ No newline at end of file From 19c4e8bd1193dc5ef56b4ff68cae328bcc61ab7e Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Tue, 13 Aug 2024 08:42:04 -0500 Subject: [PATCH 23/64] check each var --- .../scripts/setup_mobile_config.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh index 86b34ad28..7f7f30b64 100644 --- a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh +++ b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh @@ -1,8 +1,9 @@ #!/bin/bash -echo "begining replacement" +set -e +set -x + +# base_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -base_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -# echo $base_dir config_file=mobile/$1 defaults_file=resources/$2 @@ -21,8 +22,6 @@ done < <(grep -o "REPLACE_WITH_[A-Z_]*" "$defaults_file") for i in "${replace_with[@]}"; do - # printf $i - # set the value equal to the value that matches the same name in the defaults file value=$(grep -o "$i=.*" "$defaults_file") value=${value#*=} value=$(printf '%q' "$value") @@ -31,5 +30,4 @@ for i in "${replace_with[@]}"; do # replace that name in the file with the value sed -i.bak "s#<$i>#$value#g" "$config_file" fi - echo "Done replacing $i" done \ No newline at end of file From 5b2982516ca632fe4315f116c43b841aaab3dc59 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Tue, 13 Aug 2024 08:53:54 -0500 Subject: [PATCH 24/64] clean up and move --- .github/workflows/mobile.yml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 0308300d3..a6f63cd57 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -56,6 +56,17 @@ jobs: with: name: my_project path: my_project/ + - name: Create config files + run: | + ls + cp resources/app-config-js-values.txt my_project/resources/app-config-js-values.txt + cp resources/eas-json-values.txt my_project/resources/easjson-values.txt + cd my_project + chmod +x scripts/setup_mobile_config.sh + echo "ran chmod" + . scripts/setup_mobile_config.sh app.config.js app-config-js-values.txt + . scripts/setup_mobile_config.sh eas.json eas-json-values.txt + - uses: actions/cache@v4 with: path: "**/node_modules" @@ -76,19 +87,6 @@ jobs: working-directory: ./my_project/mobile run: yarn install - - name: Create config files - run: | - ls - cp resources/app-config-js-values.txt my_project/resources/app-config-js-values.txt - cp resources/eas-json-values.txt my_project/resources/easjson-values.txt - echo "Ran cp command" - cd my_project - . scripts/hello-world.sh - echo "entered the directory" - chmod +x scripts/setup_mobile_config.sh - echo "ran chmod" - . scripts/setup_mobile_config.sh app.config.js app-config-js-values.txt - . scripts/setup_mobile_config.sh eas.json eas-json-values.txt # - name: 🚀 Publish preview From 7344ffdcac85bc3c9059c33fd7e219f4c660000a Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Tue, 13 Aug 2024 09:17:09 -0500 Subject: [PATCH 25/64] skip if no var exists --- resources/eas-json-values.txt | 1 + .../resources/eas-json-values.txt | 1 + .../scripts/setup_mobile_config.sh | 17 +++++++++++------ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/resources/eas-json-values.txt b/resources/eas-json-values.txt index f0a9bcfad..038e4e8eb 100644 --- a/resources/eas-json-values.txt +++ b/resources/eas-json-values.txt @@ -14,4 +14,5 @@ REPLACE_WITH_APPSTORE_CONNECT_APP_NAME=TN Bootsrapper RN REPLACE_WITH_APPLE_ID_EMAIL_SIGNING_APP=pari@thinknimble.com REPLACE_WITH_APPLESTORE_CONNECT_ID=6446805695 REPLACE_WITH_APPLE_TEAM_ID=6BNA6HFF6B +REPLACE_WITH_REVIEW_APP_SENTRY_PROJECT_NAME=tn-bootsrapper-rn diff --git a/{{cookiecutter.project_slug}}/resources/eas-json-values.txt b/{{cookiecutter.project_slug}}/resources/eas-json-values.txt index 225945ab4..f8cd02ede 100644 --- a/{{cookiecutter.project_slug}}/resources/eas-json-values.txt +++ b/{{cookiecutter.project_slug}}/resources/eas-json-values.txt @@ -14,3 +14,4 @@ REPLACE_WITH_APPSTORE_CONNECT_APP_NAME= REPLACE_WITH_APPLE_ID_EMAIL_SIGNING_APP= REPLACE_WITH_APPLE_TEAM_ID= REPLACE_WITH_APPLESTORE_CONNECT_ID= +REPLACE_WITH_REVIEW_APP_SENTRY_PROJECT_NAME= diff --git a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh index 7f7f30b64..4cde1f68d 100644 --- a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh +++ b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh @@ -9,11 +9,11 @@ config_file=mobile/$1 defaults_file=resources/$2 -declare -a replace_with +declare -a config_vars declare -a merged_arr while IFS= read -r line; do - replace_with+=("$line") + config_vars+=("$line") done < <(grep -o "REPLACE_WITH_[A-Z_]*" "$config_file") while IFS= read -r line; do @@ -21,13 +21,18 @@ while IFS= read -r line; do done < <(grep -o "REPLACE_WITH_[A-Z_]*" "$defaults_file") -for i in "${replace_with[@]}"; do +for i in "${config_vars[@]}"; do value=$(grep -o "$i=.*" "$defaults_file") + if [[ -z $value ]]; then + echo "Skipping $i as it does not exist in $defaults_file" + continue + fi + value=${value#*=} value=$(printf '%q' "$value") - # echo $i has value $value if [[ -n $value ]]; then - # replace that name in the file with the value sed -i.bak "s#<$i>#$value#g" "$config_file" - fi + else + echo "Skipping $i as it does not exist in $defaults_file" + fi done \ No newline at end of file From d807245d1bf38699ba2488eec5a574927e630669 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Tue, 13 Aug 2024 09:30:14 -0500 Subject: [PATCH 26/64] confirm files --- .github/workflows/mobile.yml | 23 +++++++++---------- .../scripts/setup_mobile_config.sh | 7 ++++-- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index a6f63cd57..3a005b1b2 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -62,11 +62,12 @@ jobs: cp resources/app-config-js-values.txt my_project/resources/app-config-js-values.txt cp resources/eas-json-values.txt my_project/resources/easjson-values.txt cd my_project - chmod +x scripts/setup_mobile_config.sh - echo "ran chmod" . scripts/setup_mobile_config.sh app.config.js app-config-js-values.txt . scripts/setup_mobile_config.sh eas.json eas-json-values.txt + cat mobile/eas.json + cat mobile/app.config.js + - uses: actions/cache@v4 with: path: "**/node_modules" @@ -86,14 +87,12 @@ jobs: - name: 📦 Install dependencies working-directory: ./my_project/mobile run: yarn install - - - # - name: 🚀 Publish preview - # working-directory: ./my_project/mobile - # run: | - # eas update --branch="${{ github.event.deployment_status.environment_url }}" --non-interactive --auto - # echo "${{ env.BACKEND_SERVER_URL }} and ${{ github.event.deployment_status.environment_url }}" - # env: - # EXPO_PUBLIC_BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}" - # EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7" \ No newline at end of file + - name: 🚀 Publish preview + working-directory: ./my_project/mobile + run: | + eas update --branch="${{ github.event.deployment_status.environment_url }}" --non-interactive --auto + echo "${{ env.BACKEND_SERVER_URL }} and ${{ github.event.deployment_status.environment_url }}" + env: + EXPO_PUBLIC_BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}" + EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7" \ No newline at end of file diff --git a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh index 4cde1f68d..c764c8ec8 100644 --- a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh +++ b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh @@ -1,6 +1,9 @@ #!/bin/bash -set -e -set -x + +# for debugging + +# set -e +# set -x # base_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" From 1e421ee94f3b4e21e54dea146c8b314bdbc93e4d Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Tue, 13 Aug 2024 10:05:35 -0500 Subject: [PATCH 27/64] replaced original configs --- .github/workflows/mobile.yml | 6 +++--- .../clients/mobile/react-native/app.config.js | 16 ++++++++-------- .../clients/mobile/react-native/eas.json | 4 ++-- .../scripts/setup_mobile_config.sh | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 3a005b1b2..6f40b5b5c 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -60,10 +60,10 @@ jobs: run: | ls cp resources/app-config-js-values.txt my_project/resources/app-config-js-values.txt - cp resources/eas-json-values.txt my_project/resources/easjson-values.txt + cp resources/eas-json-values.txt my_project/resources/eas-json-values.txt cd my_project - . scripts/setup_mobile_config.sh app.config.js app-config-js-values.txt - . scripts/setup_mobile_config.sh eas.json eas-json-values.txt + . scripts/setup_mobile_config.sh app.config.js my_project/resources/app-config-js-values.txt + . scripts/setup_mobile_config.sh eas.json my_project/resources/eas-json-values.txt cat mobile/eas.json cat mobile/app.config.js diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/app.config.js b/{{cookiecutter.project_slug}}/clients/mobile/react-native/app.config.js index 5b43d0695..bab869d2c 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/app.config.js +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/app.config.js @@ -1,8 +1,8 @@ module.exports = { expo: { - name: 'tn mobile bootstrapper', - slug: 'tn-sample-app', - owner: 'thinknimble-bootstrapper', + name: '', + slug: '', + owner: '', version: '1.0.0', orientation: 'portrait', icon: './assets/logo-sq.png', @@ -15,13 +15,13 @@ module.exports = { assetBundlePatterns: ['**/*'], updates: { fallbackToCacheTimeout: 0, - url: 'https://u.expo.dev/ec1b86e2-2582-48cf-8a7a-c6d2772ba4f2', // uuid of app + url: 'https://u.expo.dev/', // uuid of app }, plugins: [ [ '@sentry/react-native/expo', { - organization: 'tn-bootstrapper', // replace with org in sentry + organization: '', // replace with org in sentry project: process.env.SENTRY_PROJECT_NAME, // see readme for these variables }, ], @@ -31,7 +31,7 @@ module.exports = { ], ios: { supportsTablet: true, - bundleIdentifier: 'org.thinknimble.expo.bootstrapper', // CHANGE TO BUNDLE ID + bundleIdentifier: '', // CHANGE TO BUNDLE ID config: { usesNonExemptEncryption: false, }, @@ -41,14 +41,14 @@ module.exports = { foregroundImage: './assets/logo-sq.png', backgroundColor: '#FFFFFF', }, - package: 'com.example.app', // CHANGE TO PACKAGE ID + package: '', // CHANGE TO PACKAGE ID }, web: { favicon: './assets/logo-sq.png', }, extra: { eas: { - projectId: 'ec1b86e2-2582-48cf-8a7a-c6d2772ba4f2', // uuid of app + projectId: '', // uuid of app }, // these values are hardcoded and provided in eas.json backendServerUrl: process.env.BACKEND_SERVER_URL, diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json b/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json index a3e9b4b25..0653c4a84 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json @@ -67,8 +67,8 @@ "ios": { "appName": "", "appleId": "", - "ascAppId": "", - "appleTeamId": "" + "appleTeamId": "", + "ascAppId": " Date: Tue, 13 Aug 2024 10:10:31 -0500 Subject: [PATCH 28/64] updated the pipeline to use a newer version --- .github/workflows/mobile.yml | 2 +- {{cookiecutter.project_slug}}/scripts/hello-world.sh | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) delete mode 100644 {{cookiecutter.project_slug}}/scripts/hello-world.sh diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 6f40b5b5c..f3ddb790c 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -78,7 +78,7 @@ jobs: node-version: 18.x - name: 🏗 Setup Expo and EAS - uses: expo/expo-github-action@v7 + uses: expo/expo-github-action@v8 with: expo-version: latest eas-version: latest diff --git a/{{cookiecutter.project_slug}}/scripts/hello-world.sh b/{{cookiecutter.project_slug}}/scripts/hello-world.sh deleted file mode 100644 index 373d0526b..000000000 --- a/{{cookiecutter.project_slug}}/scripts/hello-world.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -# This is a test -echo "Hello World" \ No newline at end of file From 3e9b3c9f0a34f8ac80e64bda579e689c3910f283 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Tue, 13 Aug 2024 11:03:11 -0500 Subject: [PATCH 29/64] change the directories --- .github/workflows/mobile.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index f3ddb790c..ab766fffe 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -62,8 +62,8 @@ jobs: cp resources/app-config-js-values.txt my_project/resources/app-config-js-values.txt cp resources/eas-json-values.txt my_project/resources/eas-json-values.txt cd my_project - . scripts/setup_mobile_config.sh app.config.js my_project/resources/app-config-js-values.txt - . scripts/setup_mobile_config.sh eas.json my_project/resources/eas-json-values.txt + . scripts/setup_mobile_config.sh app.config.js resources/app-config-js-values.txt + . scripts/setup_mobile_config.sh eas.json resources/eas-json-values.txt cat mobile/eas.json cat mobile/app.config.js From 8376b18ed1276347f71f56308321263d06652555 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Tue, 13 Aug 2024 11:16:14 -0500 Subject: [PATCH 30/64] not finding the configs --- .github/workflows/mobile.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index ab766fffe..3e01b07a2 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -62,6 +62,12 @@ jobs: cp resources/app-config-js-values.txt my_project/resources/app-config-js-values.txt cp resources/eas-json-values.txt my_project/resources/eas-json-values.txt cd my_project + base_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + echo $base_dir + ls + echo "RESOURCES" + ls resources + . scripts/setup_mobile_config.sh app.config.js resources/app-config-js-values.txt . scripts/setup_mobile_config.sh eas.json resources/eas-json-values.txt From 1f73d70dd5117c919e7d6119dedd0877af39bac1 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Tue, 13 Aug 2024 11:54:37 -0500 Subject: [PATCH 31/64] not finding the configs --- .github/workflows/mobile.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 3e01b07a2..c5f828807 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -64,9 +64,10 @@ jobs: cd my_project base_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" echo $base_dir + echo $pwd + ls - echo "RESOURCES" - ls resources + . scripts/setup_mobile_config.sh app.config.js resources/app-config-js-values.txt . scripts/setup_mobile_config.sh eas.json resources/eas-json-values.txt From 0479a28cdcf30b5ac6f3ba7ef69cc43af73bb3f5 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Tue, 13 Aug 2024 12:02:37 -0500 Subject: [PATCH 32/64] see cwd --- .github/workflows/mobile.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index c5f828807..acec0c2f0 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -65,9 +65,8 @@ jobs: base_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" echo $base_dir echo $pwd - - ls - + current_dir=$(pwd) + echo $current_dir . scripts/setup_mobile_config.sh app.config.js resources/app-config-js-values.txt . scripts/setup_mobile_config.sh eas.json resources/eas-json-values.txt From ac1c91f299eb640e678abba269d6a3f3847d4258 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Tue, 13 Aug 2024 12:08:44 -0500 Subject: [PATCH 33/64] updated cwd --- .github/workflows/mobile.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index acec0c2f0..d604db576 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -62,14 +62,9 @@ jobs: cp resources/app-config-js-values.txt my_project/resources/app-config-js-values.txt cp resources/eas-json-values.txt my_project/resources/eas-json-values.txt cd my_project - base_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - echo $base_dir - echo $pwd current_dir=$(pwd) - echo $current_dir - - . scripts/setup_mobile_config.sh app.config.js resources/app-config-js-values.txt - . scripts/setup_mobile_config.sh eas.json resources/eas-json-values.txt + . scripts/setup_mobile_config.sh app.config.js "$current_dir/resources/app-config-js-values.txt" + . scripts/setup_mobile_config.sh eas.json "$current_dir/resources/resources/eas-json-values.txt" cat mobile/eas.json cat mobile/app.config.js From e57936f355d0c658d4294afeddbb14b01d1c55da Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Tue, 13 Aug 2024 12:22:41 -0500 Subject: [PATCH 34/64] fix dirs --- .github/workflows/mobile.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index d604db576..1867dca45 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -63,8 +63,8 @@ jobs: cp resources/eas-json-values.txt my_project/resources/eas-json-values.txt cd my_project current_dir=$(pwd) - . scripts/setup_mobile_config.sh app.config.js "$current_dir/resources/app-config-js-values.txt" - . scripts/setup_mobile_config.sh eas.json "$current_dir/resources/resources/eas-json-values.txt" + . scripts/setup_mobile_config.sh "$current_dir/app.config.js" "$current_dir/resources/app-config-js-values.txt" + . scripts/setup_mobile_config.sh "$current_dir/eas.json" "$current_dir/resources/resources/eas-json-values.txt" cat mobile/eas.json cat mobile/app.config.js From b38b7aaf3f1b218e73a46874219e0b08145ddf1d Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Tue, 13 Aug 2024 12:34:18 -0500 Subject: [PATCH 35/64] hard code dir --- .github/workflows/mobile.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 1867dca45..57a939a2e 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -17,6 +17,8 @@ jobs: - name: Install bootstrapper dependencies run: pipenv install --dev --deploy - run: | + current_dir=$(pwd) + echo $current_dir config_file=$(./scripts/vue_or_react.sh) pipenv run cookiecutter . --config-file $config_file --no-input -f cat $config_file @@ -63,8 +65,9 @@ jobs: cp resources/eas-json-values.txt my_project/resources/eas-json-values.txt cd my_project current_dir=$(pwd) - . scripts/setup_mobile_config.sh "$current_dir/app.config.js" "$current_dir/resources/app-config-js-values.txt" - . scripts/setup_mobile_config.sh "$current_dir/eas.json" "$current_dir/resources/resources/eas-json-values.txt" + echo $current_dir + . scripts/setup_mobile_config.sh "/home/runner/work/tn-spa-bootstrapper/my_project/mobile/app.config.js" "/home/runner/work/tn-spa-bootstrapper/my_project/resources/app-config-js-values.txt" + . scripts/setup_mobile_config.sh "/home/runner/work/tn-spa-bootstrapper/my_project/mobile/eas.json" "/home/runner/work/tn-spa-bootstrapper/my_project/resources/eas-json-values.txt" cat mobile/eas.json cat mobile/app.config.js From 22897082735535ac8af0d31256f7032765e8eab0 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Tue, 13 Aug 2024 12:40:08 -0500 Subject: [PATCH 36/64] cwd --- .github/workflows/mobile.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 57a939a2e..ebe219836 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -66,8 +66,8 @@ jobs: cd my_project current_dir=$(pwd) echo $current_dir - . scripts/setup_mobile_config.sh "/home/runner/work/tn-spa-bootstrapper/my_project/mobile/app.config.js" "/home/runner/work/tn-spa-bootstrapper/my_project/resources/app-config-js-values.txt" - . scripts/setup_mobile_config.sh "/home/runner/work/tn-spa-bootstrapper/my_project/mobile/eas.json" "/home/runner/work/tn-spa-bootstrapper/my_project/resources/eas-json-values.txt" + . scripts/setup_mobile_config.sh "current_dir/mobile/app.config.js" "current_dir/resources/app-config-js-values.txt" + . scripts/setup_mobile_config.sh "current_dir/mobile/eas.json" "current_dir/resources/eas-json-values.txt" cat mobile/eas.json cat mobile/app.config.js From 051986636d8b26abbc3791dc556cbcc56e8d6d2c Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Tue, 13 Aug 2024 12:52:24 -0500 Subject: [PATCH 37/64] missing var --- .github/workflows/mobile.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index ebe219836..95b98d188 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -66,8 +66,8 @@ jobs: cd my_project current_dir=$(pwd) echo $current_dir - . scripts/setup_mobile_config.sh "current_dir/mobile/app.config.js" "current_dir/resources/app-config-js-values.txt" - . scripts/setup_mobile_config.sh "current_dir/mobile/eas.json" "current_dir/resources/eas-json-values.txt" + . scripts/setup_mobile_config.sh "$current_dir/mobile/app.config.js" "$current_dir/resources/app-config-js-values.txt" + . scripts/setup_mobile_config.sh "$current_dir/mobile/eas.json" "$current_dir/resources/eas-json-values.txt" cat mobile/eas.json cat mobile/app.config.js From 767f03ea05e5708bfdca8d211d52ad46cef04a82 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Tue, 13 Aug 2024 13:03:25 -0500 Subject: [PATCH 38/64] remove logs add debugger --- .github/workflows/mobile.yml | 1 - .../scripts/setup_mobile_config.sh | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 95b98d188..f0083b181 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -60,7 +60,6 @@ jobs: path: my_project/ - name: Create config files run: | - ls cp resources/app-config-js-values.txt my_project/resources/app-config-js-values.txt cp resources/eas-json-values.txt my_project/resources/eas-json-values.txt cd my_project diff --git a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh index 614ec7de6..ba2cc3346 100644 --- a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh +++ b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh @@ -2,8 +2,8 @@ # for debugging -# set -e -# set -x +set -e +set -x # base_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" @@ -19,9 +19,9 @@ while IFS= read -r line; do config_vars+=("$line") done < <(grep -o "REPLACE_WITH_[A-Z_]*" "$config_file") -while IFS= read -r line; do - merged_arr+=("$line") -done < <(grep -o "REPLACE_WITH_[A-Z_]*" "$defaults_file") +# while IFS= read -r line; do +# merged_arr+=("$line") +# done < <(grep -o "REPLACE_WITH_[A-Z_]*" "$defaults_file") for i in "${config_vars[@]}"; do From 485952c4747d3bd6dd94ee77d4e1e373c10c8408 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Tue, 13 Aug 2024 13:13:29 -0500 Subject: [PATCH 39/64] reset var on exit and default to es --- .../scripts/setup_mobile_config.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh index ba2cc3346..948ee1da2 100644 --- a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh +++ b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh @@ -15,6 +15,11 @@ defaults_file=$2 declare -a config_vars declare -a merged_arr +reset_config_vars() { + unset config_vars +} +trap reset_config_vars EXIT + while IFS= read -r line; do config_vars+=("$line") done < <(grep -o "REPLACE_WITH_[A-Z_]*" "$config_file") @@ -25,7 +30,7 @@ done < <(grep -o "REPLACE_WITH_[A-Z_]*" "$config_file") for i in "${config_vars[@]}"; do - value=$(grep -o "$i=.*" "$defaults_file") + value=$(grep -o "$i=.*" "$defaults_file") || echo "" if [[ -z $value ]]; then echo "Skipping $i as it does not exist in $defaults_file" continue From bd639cea6de5712d315ab51c5a0c62139c930b12 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Tue, 13 Aug 2024 13:30:14 -0500 Subject: [PATCH 40/64] switch to node instead of yarn --- .github/workflows/mobile.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index f0083b181..069ae986e 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -64,21 +64,19 @@ jobs: cp resources/eas-json-values.txt my_project/resources/eas-json-values.txt cd my_project current_dir=$(pwd) - echo $current_dir . scripts/setup_mobile_config.sh "$current_dir/mobile/app.config.js" "$current_dir/resources/app-config-js-values.txt" . scripts/setup_mobile_config.sh "$current_dir/mobile/eas.json" "$current_dir/resources/eas-json-values.txt" - cat mobile/eas.json - cat mobile/app.config.js - - uses: actions/cache@v4 with: path: "**/node_modules" - key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + key: ${{ runner.os }}-modules-${{ hashFiles('**/package-json.lock') }} - name: 🏗 Setup Node uses: actions/setup-node@v4 with: node-version: 18.x + cache: npm + cache-dependency-path: ./mobile/package-lock.json - name: 🏗 Setup Expo and EAS uses: expo/expo-github-action@v8 @@ -89,7 +87,7 @@ jobs: - name: 📦 Install dependencies working-directory: ./my_project/mobile - run: yarn install + run: npm install - name: 🚀 Publish preview working-directory: ./my_project/mobile From fdb343abfadf4a95a0aac0bf90f6e761403adfa3 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Tue, 13 Aug 2024 13:36:05 -0500 Subject: [PATCH 41/64] fix cache --- .github/workflows/mobile.yml | 2 +- .../scripts/setup_mobile_config.sh | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 069ae986e..31ea8138d 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -70,7 +70,7 @@ jobs: - uses: actions/cache@v4 with: path: "**/node_modules" - key: ${{ runner.os }}-modules-${{ hashFiles('**/package-json.lock') }} + key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }} - name: 🏗 Setup Node uses: actions/setup-node@v4 with: diff --git a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh index 948ee1da2..8af29dc03 100644 --- a/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh +++ b/{{cookiecutter.project_slug}}/scripts/setup_mobile_config.sh @@ -2,8 +2,8 @@ # for debugging -set -e -set -x +# set -e +# set -x # base_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" @@ -24,10 +24,6 @@ while IFS= read -r line; do config_vars+=("$line") done < <(grep -o "REPLACE_WITH_[A-Z_]*" "$config_file") -# while IFS= read -r line; do -# merged_arr+=("$line") -# done < <(grep -o "REPLACE_WITH_[A-Z_]*" "$defaults_file") - for i in "${config_vars[@]}"; do value=$(grep -o "$i=.*" "$defaults_file") || echo "" From 6c75751f2937cdde44a535d4907b7ae044262957 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Tue, 13 Aug 2024 14:23:12 -0500 Subject: [PATCH 42/64] updated to remove cache --- .github/workflows/mobile.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 31ea8138d..67d7a2ee1 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -67,10 +67,10 @@ jobs: . scripts/setup_mobile_config.sh "$current_dir/mobile/app.config.js" "$current_dir/resources/app-config-js-values.txt" . scripts/setup_mobile_config.sh "$current_dir/mobile/eas.json" "$current_dir/resources/eas-json-values.txt" - - uses: actions/cache@v4 - with: - path: "**/node_modules" - key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }} + # - uses: actions/cache@v4 + # with: + # path: "**/node_modules" + # key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }} - name: 🏗 Setup Node uses: actions/setup-node@v4 with: From 476ddf9e82ace1aa4c7d63668a4d4701b57dbfa3 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Tue, 13 Aug 2024 14:32:31 -0500 Subject: [PATCH 43/64] added cache --- .github/workflows/mobile.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 67d7a2ee1..57056ec59 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -75,8 +75,8 @@ jobs: uses: actions/setup-node@v4 with: node-version: 18.x - cache: npm - cache-dependency-path: ./mobile/package-lock.json + # cache: npm + # cache-dependency-path: ./mobile/package-lock.json - name: 🏗 Setup Expo and EAS uses: expo/expo-github-action@v8 From 261d614001a0aea66d6ce3ca3b11cc949a22691c Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Tue, 13 Aug 2024 14:50:54 -0500 Subject: [PATCH 44/64] update names and readme --- .github/workflows/mobile.yml | 10 ++++------ ...nfig-js-values.txt => app.config.vars.txt} | 0 .../{eas-json-values.txt => eas.vars.txt} | 0 .../clients/mobile/react-native/README.md | 20 +++++++++++++++++-- ...alues.txt => app.config.vars.template.txt} | 0 ...-json-values.txt => eas.vars.template.txt} | 0 6 files changed, 22 insertions(+), 8 deletions(-) rename resources/{app-config-js-values.txt => app.config.vars.txt} (100%) rename resources/{eas-json-values.txt => eas.vars.txt} (100%) rename {{cookiecutter.project_slug}}/resources/{app-config-js-values.txt => app.config.vars.template.txt} (100%) rename {{cookiecutter.project_slug}}/resources/{eas-json-values.txt => eas.vars.template.txt} (100%) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 57056ec59..ae61be45f 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -17,8 +17,6 @@ jobs: - name: Install bootstrapper dependencies run: pipenv install --dev --deploy - run: | - current_dir=$(pwd) - echo $current_dir config_file=$(./scripts/vue_or_react.sh) pipenv run cookiecutter . --config-file $config_file --no-input -f cat $config_file @@ -60,12 +58,12 @@ jobs: path: my_project/ - name: Create config files run: | - cp resources/app-config-js-values.txt my_project/resources/app-config-js-values.txt - cp resources/eas-json-values.txt my_project/resources/eas-json-values.txt + cp resources/app.config.vars.txt my_project/resources/app.config.vars.txt + cp resources/eas.vars.txt my_project/resources/eas.vars.txt cd my_project current_dir=$(pwd) - . scripts/setup_mobile_config.sh "$current_dir/mobile/app.config.js" "$current_dir/resources/app-config-js-values.txt" - . scripts/setup_mobile_config.sh "$current_dir/mobile/eas.json" "$current_dir/resources/eas-json-values.txt" + . scripts/setup_mobile_config.sh "$current_dir/mobile/app.config.js" "$current_dir/resources/app.config.vars.txt" + . scripts/setup_mobile_config.sh "$current_dir/mobile/eas.json" "$current_dir/resources/eas.vars.txt" # - uses: actions/cache@v4 # with: diff --git a/resources/app-config-js-values.txt b/resources/app.config.vars.txt similarity index 100% rename from resources/app-config-js-values.txt rename to resources/app.config.vars.txt diff --git a/resources/eas-json-values.txt b/resources/eas.vars.txt similarity index 100% rename from resources/eas-json-values.txt rename to resources/eas.vars.txt diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/README.md b/{{cookiecutter.project_slug}}/clients/mobile/react-native/README.md index c9cfd4eef..e1aad464c 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/README.md +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/README.md @@ -15,9 +15,11 @@ User `npm run start` to run the app and source the env variables alternatively if you want to use expo run command -`source .env && SENTRY_PROJECT=${SENTRY_PROJECT_NAME} npx expo start` +`source .env && npx expo start` -**When running the app locally and working against a local backend you will need to use a proxy** +Run against a local backend using the ip address instead of local host + +**When running the app locally and working against a local backend with a proxy** 1. Download and install ngrok 2. Set up ngrok auth token (request an account from William Huster) @@ -59,6 +61,20 @@ Set the `SENTRY_AUTH_TOKEN` in Expo under `Secrets` (see `Error Logging & Crash For local run set environment variables in .env file (from [.env.example](./.env.example)) For builds set env variables in eas.json + + +## Use the helper script to enter variables + +Complete the eas.vars.template.txt + +complete the app.config.vars.template.txt + +`. scripts/setup_mobile_config.sh eas.json /resources/eas.vars.txt` + +`. scripts/setup_mobile_config.sh eas.json /resources/app.config.vars.txt` + + + ### Eas Project Configuration in [app.config.js](./app.config.js) set the confiuration variables diff --git a/{{cookiecutter.project_slug}}/resources/app-config-js-values.txt b/{{cookiecutter.project_slug}}/resources/app.config.vars.template.txt similarity index 100% rename from {{cookiecutter.project_slug}}/resources/app-config-js-values.txt rename to {{cookiecutter.project_slug}}/resources/app.config.vars.template.txt diff --git a/{{cookiecutter.project_slug}}/resources/eas-json-values.txt b/{{cookiecutter.project_slug}}/resources/eas.vars.template.txt similarity index 100% rename from {{cookiecutter.project_slug}}/resources/eas-json-values.txt rename to {{cookiecutter.project_slug}}/resources/eas.vars.template.txt From e2afa80705733c0eac9fd04d993b228d28097283 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Thu, 15 Aug 2024 08:21:59 -0500 Subject: [PATCH 45/64] removed comment --- .github/workflows/mobile.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index ae61be45f..16a54cc2b 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -2,7 +2,6 @@ name: Mobile Deployment on: [deployment_status, workflow_dispatch] jobs: - # TODO move this to a common file Setup: if: github.event.deployment_status.state == 'success' runs-on: ubuntu-latest From 8ef69ea0c1902d1b71a7d300ed82706db67b37e5 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Thu, 15 Aug 2024 09:30:05 -0500 Subject: [PATCH 46/64] add dynamic PR builds --- .github/workflows/mobile.yml | 54 +++++++++++++------ .../clients/mobile/react-native/eas.json | 5 -- 2 files changed, 39 insertions(+), 20 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 16a54cc2b..780ec6ba2 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -75,22 +75,46 @@ jobs: # cache: npm # cache-dependency-path: ./mobile/package-lock.json - - name: 🏗 Setup Expo and EAS - uses: expo/expo-github-action@v8 - with: - expo-version: latest - eas-version: latest - token: ${{ secrets.EXPO_TOKEN }} + # - name: 🏗 Setup Expo and EAS + # uses: expo/expo-github-action@v8 + # with: + # expo-version: latest + # eas-version: latest + # token: ${{ secrets.EXPO_TOKEN }} - - name: 📦 Install dependencies - working-directory: ./my_project/mobile - run: npm install + # - name: 📦 Install dependencies + # working-directory: ./my_project/mobile + # run: npm install - - name: 🚀 Publish preview + # - name: 🚀 Publish preview + # working-directory: ./my_project/mobile + # run: | + # eas update --branch="${{ github.event.deployment_status.environment_url }}" --non-interactive --auto + # echo "${{ env.BACKEND_SERVER_URL }} and ${{ github.event.deployment_status.environment_url }}" + # env: + # EXPO_PUBLIC_BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}" + # EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7" + + - name: Update EAS Config working-directory: ./my_project/mobile run: | - eas update --branch="${{ github.event.deployment_status.environment_url }}" --non-interactive --auto - echo "${{ env.BACKEND_SERVER_URL }} and ${{ github.event.deployment_status.environment_url }}" - env: - EXPO_PUBLIC_BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}" - EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7" \ No newline at end of file + PR_NUMBER=${{ github.event.number }} + jq --arg pr_number "$PR_NUMBER" '.build["review_" + $pr_number] = { + "developmentClient": true, + "distribution": "internal", + "channel": "", + "env": { + "BACKEND_SERVER_URL": "${{ github.event.deployment_status.environment_url }}", + "ROLLBAR_ACCESS_TOKEN": "1a19e5da05b2435b802d5a81aba2bbd7", + "SENTRY_DSN": "https://a7cea97f07ac42fa9e28800b037997c9@o4504899535962112.ingest.sentry.io/4504906332897280", + } + }' eas.json > tmp.$$.json && mv tmp.$$.json eas.json + + - name: Display Updated EAS Config + run: cat eas.json + + # - name: 🔨 Publish Build & Preview + # working-directory: ./my_project/mobile + + # run: | + # eas build --platform ios --profile ${{ github.event.pull_request.number }} && eas update --branch="${{ github.event.deployment_status.environment_url }}" --non-interactive --auto \ No newline at end of file diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json b/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json index 0653c4a84..4e7204a8b 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json @@ -10,7 +10,6 @@ "channel": "development", "env": { "BACKEND_SERVER_URL": "", - "BUILD_ENV": "development", "ROLLBAR_ACCESS_TOKEN": "", "SENTRY_DSN": "" } @@ -21,7 +20,6 @@ "channel": "review", "env": { "BACKEND_SERVER_URL": "", - "BUILD_ENV": "review", "ROLLBAR_ACCESS_TOKEN": "", "SENTRY_PROJECT_NAME": "", "SENTRY_DSN": "" @@ -33,7 +31,6 @@ "channel": "development", "env": { "BACKEND_SERVER_URL": "", - "BUILD_ENV": "development", "ROLLBAR_ACCESS_TOKEN": "", "SENTRY_DSN": "" }, @@ -46,7 +43,6 @@ "channel": "staging", "env": { "BACKEND_SERVER_URL": "", - "BUILD_ENV": "staging", "ROLLBAR_ACCESS_TOKEN": "", "SENTRY_DSN": "" } @@ -56,7 +52,6 @@ "autoIncrement": true, "env": { "BACKEND_SERVER_URL": "", - "BUILD_ENV": "production", "ROLLBAR_ACCESS_TOKEN": "", "SENTRY_DSN": "" } From 70fb752c57c3588ea7cd8331184f5c3e4f86ba49 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Thu, 15 Aug 2024 10:06:50 -0500 Subject: [PATCH 47/64] updated the echo --- .github/workflows/mobile.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 780ec6ba2..259f83c3e 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -111,6 +111,7 @@ jobs: }' eas.json > tmp.$$.json && mv tmp.$$.json eas.json - name: Display Updated EAS Config + working-directory: ./my_project/mobile run: cat eas.json # - name: 🔨 Publish Build & Preview From 72e4c2e2c80ca65dab87798dcd8a5269ac6ff907 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Thu, 15 Aug 2024 10:21:34 -0500 Subject: [PATCH 48/64] regex to get PR number --- .github/workflows/mobile.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 259f83c3e..000ecda1e 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -98,7 +98,7 @@ jobs: - name: Update EAS Config working-directory: ./my_project/mobile run: | - PR_NUMBER=${{ github.event.number }} + PR_NUMBER=$(echo "$url" | grep -oP '(?<=pr-)\d+') jq --arg pr_number "$PR_NUMBER" '.build["review_" + $pr_number] = { "developmentClient": true, "distribution": "internal", From 3417a660969e8f7f691a095594b0809811530fbf Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Thu, 15 Aug 2024 10:26:12 -0500 Subject: [PATCH 49/64] forgot url --- .github/workflows/mobile.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 000ecda1e..a9fa4962e 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -98,6 +98,7 @@ jobs: - name: Update EAS Config working-directory: ./my_project/mobile run: | + url=${{ github.event.deployment_status.environment_url }} PR_NUMBER=$(echo "$url" | grep -oP '(?<=pr-)\d+') jq --arg pr_number "$PR_NUMBER" '.build["review_" + $pr_number] = { "developmentClient": true, @@ -114,7 +115,8 @@ jobs: working-directory: ./my_project/mobile run: cat eas.json - # - name: 🔨 Publish Build & Preview + # note: you will need to register your device first using eas device:create & eas credentials to test this + # - name: 🔨 Build & Update App # working-directory: ./my_project/mobile # run: | From 3f4fe157aaa493c013d12e93a67f0537fdfdbe87 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Thu, 15 Aug 2024 10:43:35 -0500 Subject: [PATCH 50/64] added sheet with vars --- .github/workflows/mobile.yml | 34 +++++++++---------- .../mobile/react-native/src/screens/main.tsx | 12 +++++++ 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index a9fa4962e..556e876d0 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -75,25 +75,25 @@ jobs: # cache: npm # cache-dependency-path: ./mobile/package-lock.json - # - name: 🏗 Setup Expo and EAS - # uses: expo/expo-github-action@v8 - # with: - # expo-version: latest - # eas-version: latest - # token: ${{ secrets.EXPO_TOKEN }} + - name: 🏗 Setup Expo and EAS + uses: expo/expo-github-action@v8 + with: + expo-version: latest + eas-version: latest + token: ${{ secrets.EXPO_TOKEN }} - # - name: 📦 Install dependencies - # working-directory: ./my_project/mobile - # run: npm install + - name: 📦 Install dependencies + working-directory: ./my_project/mobile + run: npm install - # - name: 🚀 Publish preview - # working-directory: ./my_project/mobile - # run: | - # eas update --branch="${{ github.event.deployment_status.environment_url }}" --non-interactive --auto - # echo "${{ env.BACKEND_SERVER_URL }} and ${{ github.event.deployment_status.environment_url }}" - # env: - # EXPO_PUBLIC_BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}" - # EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7" + - name: 🚀 Publish preview + working-directory: ./my_project/mobile + run: | + eas update --branch="${{ github.event.deployment_status.environment_url }}" --non-interactive --auto + echo "${{ env.BACKEND_SERVER_URL }} and ${{ github.event.deployment_status.environment_url }}" + env: + EXPO_PUBLIC_BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}" + EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7" - name: Update EAS Config working-directory: ./my_project/mobile diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/src/screens/main.tsx b/{{cookiecutter.project_slug}}/clients/mobile/react-native/src/screens/main.tsx index 645970945..becceb3dc 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/src/screens/main.tsx +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/src/screens/main.tsx @@ -1,6 +1,9 @@ import { Dimensions, Image, StyleSheet, View } from 'react-native' import logo from '@assets/tn-logo.png' import { Text } from '@components/text' +import { BButton } from '@components/Button' +import { SheetManager } from 'react-native-actions-sheet' +import { SHEET_NAMES } from '@components/sheets' const { height } = Dimensions.get('screen') @@ -16,6 +19,14 @@ const styles = StyleSheet.create({ }) export const Main = () => { + const onOpenSheet = () => { + SheetManager.show(SHEET_NAMES.test, { + payload: { + input: 'Hello from payload', + }, + }) + } + return ( @@ -26,6 +37,7 @@ export const Main = () => { Welcome to my project + ) } From 0ad55e212ca348c546a20cce129c2785fc2a7f0e Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Thu, 15 Aug 2024 10:45:17 -0500 Subject: [PATCH 51/64] added vars sheet --- .../clients/mobile/react-native/Config.d.ts | 5 ++++- .../clients/mobile/react-native/Config.js | 11 ++++++++++- .../clients/mobile/react-native/src/screens/main.tsx | 3 ++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/Config.d.ts b/{{cookiecutter.project_slug}}/clients/mobile/react-native/Config.d.ts index 369f9bca2..b23ef6c86 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/Config.d.ts +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/Config.d.ts @@ -6,5 +6,8 @@ declare const Config: { sentryDSN: string isExpoGo?: boolean } - +declare const vars :{ + [key:string]: any +} export default Config +export { vars } diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/Config.js b/{{cookiecutter.project_slug}}/clients/mobile/react-native/Config.js index 8f2e3b6e9..4593375e6 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/Config.js +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/Config.js @@ -73,4 +73,13 @@ const ENV = () => { } const Config = { ...ENV() } -export default Config \ No newline at end of file +export default Config + +export const vars = { + BACKEND_SERVER_URL, + SENTRY_DSN, + ROLLBAR_ACCESS_TOKEN, + backendServerUrl, + rollbarAccessToken, + sentryDSN, +} \ No newline at end of file diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/src/screens/main.tsx b/{{cookiecutter.project_slug}}/clients/mobile/react-native/src/screens/main.tsx index becceb3dc..67ed32ff1 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/src/screens/main.tsx +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/src/screens/main.tsx @@ -4,6 +4,7 @@ import { Text } from '@components/text' import { BButton } from '@components/Button' import { SheetManager } from 'react-native-actions-sheet' import { SHEET_NAMES } from '@components/sheets' +import { vars } from '../../Config' const { height } = Dimensions.get('screen') @@ -22,7 +23,7 @@ export const Main = () => { const onOpenSheet = () => { SheetManager.show(SHEET_NAMES.test, { payload: { - input: 'Hello from payload', + input: JSON.stringify(vars), }, }) } From 9a5ebf91c0e941e8949dda467de551a483f63178 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Thu, 15 Aug 2024 11:24:17 -0500 Subject: [PATCH 52/64] updated app --- .github/workflows/mobile.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 556e876d0..76adfb171 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -86,11 +86,17 @@ jobs: working-directory: ./my_project/mobile run: npm install + - name: Set Variables + run: + backend_url=${{ github.event.deployment_status.environment_url }} >> $GITHUB_ENV + PR_NUMBER=$(echo "$backend_url" | grep -oP '(?<=pr-)\d+') >> $GITHUB_ENV + REPO_NAME=${{ github.repository }} + EXPO_NAME="${{ env.REPO_NAME }}-${{ env.PR_NUMBER }}" + - name: 🚀 Publish preview working-directory: ./my_project/mobile run: | - eas update --branch="${{ github.event.deployment_status.environment_url }}" --non-interactive --auto - echo "${{ env.BACKEND_SERVER_URL }} and ${{ github.event.deployment_status.environment_url }}" + eas update --branch=${{ env.EXPO_NAME }} --non-interactive --auto env: EXPO_PUBLIC_BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}" EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7" @@ -98,9 +104,7 @@ jobs: - name: Update EAS Config working-directory: ./my_project/mobile run: | - url=${{ github.event.deployment_status.environment_url }} - PR_NUMBER=$(echo "$url" | grep -oP '(?<=pr-)\d+') - jq --arg pr_number "$PR_NUMBER" '.build["review_" + $pr_number] = { + jq --arg pr_number "${{ env.PR_NUMBER }}" '.build["review_" + $pr_number] = { "developmentClient": true, "distribution": "internal", "channel": "", @@ -120,4 +124,4 @@ jobs: # working-directory: ./my_project/mobile # run: | - # eas build --platform ios --profile ${{ github.event.pull_request.number }} && eas update --branch="${{ github.event.deployment_status.environment_url }}" --non-interactive --auto \ No newline at end of file + # eas build --platform ios --profile ${{ env.PR_NUMBER }} && eas update --branch="${{ env.EXPO_NAME }}" --non-interactive --auto \ No newline at end of file From 5f5fdbde56b683181971bc264a1f0da04506d31b Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Thu, 15 Aug 2024 11:31:05 -0500 Subject: [PATCH 53/64] updated to echo output --- .github/workflows/mobile.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 76adfb171..d4aef9b56 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -90,8 +90,8 @@ jobs: run: backend_url=${{ github.event.deployment_status.environment_url }} >> $GITHUB_ENV PR_NUMBER=$(echo "$backend_url" | grep -oP '(?<=pr-)\d+') >> $GITHUB_ENV - REPO_NAME=${{ github.repository }} - EXPO_NAME="${{ env.REPO_NAME }}-${{ env.PR_NUMBER }}" + REPO_NAME=${{ github.repository }} >> $GITHUB_ENV + EXPO_NAME="${{ env.REPO_NAME }}-${{ env.PR_NUMBER }}" >> $GITHUB_ENV - name: 🚀 Publish preview working-directory: ./my_project/mobile From 7ff342fa9c31a51bdf023ebedd7c55f556e11cf0 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Thu, 15 Aug 2024 11:33:09 -0500 Subject: [PATCH 54/64] fix typo and set vars in one line --- .github/workflows/mobile.yml | 5 +---- .../clients/mobile/react-native/eas.json | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index d4aef9b56..03e567781 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -88,10 +88,7 @@ jobs: - name: Set Variables run: - backend_url=${{ github.event.deployment_status.environment_url }} >> $GITHUB_ENV - PR_NUMBER=$(echo "$backend_url" | grep -oP '(?<=pr-)\d+') >> $GITHUB_ENV - REPO_NAME=${{ github.repository }} >> $GITHUB_ENV - EXPO_NAME="${{ env.REPO_NAME }}-${{ env.PR_NUMBER }}" >> $GITHUB_ENV + echo "backend_url=${{ github.event.deployment_status.environment_url }} PR_NUMBER=$(echo ${{ github.event.deployment_status.environment_url }} | grep -oP '(?<=pr-)\d+') REPO_NAME=${{ github.repository }} EXPO_NAME=${{ github.repository }}-$(echo ${{ github.event.deployment_status.environment_url }} | grep -oP '(?<=pr-)\d+')" | xargs -n 1 >> $GITHUB_ENV - name: 🚀 Publish preview working-directory: ./my_project/mobile diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json b/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json index 4e7204a8b..d0f573a1e 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json @@ -63,7 +63,7 @@ "appName": "", "appleId": "", "appleTeamId": "", - "ascAppId": "" } } } From 18f8ba99a2e0b929f93d19aa491dd8989fa2db05 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Thu, 15 Aug 2024 11:42:16 -0500 Subject: [PATCH 55/64] try with vars again --- .github/workflows/mobile.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 03e567781..5b15ce3ec 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -88,7 +88,10 @@ jobs: - name: Set Variables run: - echo "backend_url=${{ github.event.deployment_status.environment_url }} PR_NUMBER=$(echo ${{ github.event.deployment_status.environment_url }} | grep -oP '(?<=pr-)\d+') REPO_NAME=${{ github.repository }} EXPO_NAME=${{ github.repository }}-$(echo ${{ github.event.deployment_status.environment_url }} | grep -oP '(?<=pr-)\d+')" | xargs -n 1 >> $GITHUB_ENV + backend_url=${{ github.event.deployment_status.environment_url }} >> $GITHUB_ENV + PR_NUMBER=$(echo "$backend_url" | grep -oP '(?<=pr-)\d+') >> $GITHUB_ENV + REPO_NAME=${{ github.repository }} >> $GITHUB_ENV + EXPO_NAME="${{ github.repository }}-$PR_NUMBER" >> $GITHUB_ENV - name: 🚀 Publish preview working-directory: ./my_project/mobile From 68068fae9acb5ca99b206de50270ff33537be855 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Thu, 15 Aug 2024 11:50:29 -0500 Subject: [PATCH 56/64] added missing echo --- .github/workflows/mobile.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 5b15ce3ec..a10c9b12e 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -88,10 +88,10 @@ jobs: - name: Set Variables run: - backend_url=${{ github.event.deployment_status.environment_url }} >> $GITHUB_ENV - PR_NUMBER=$(echo "$backend_url" | grep -oP '(?<=pr-)\d+') >> $GITHUB_ENV - REPO_NAME=${{ github.repository }} >> $GITHUB_ENV - EXPO_NAME="${{ github.repository }}-$PR_NUMBER" >> $GITHUB_ENV + echo "backend_url=${{ github.event.deployment_status.environment_url }}" >> $GITHUB_ENV + echo "PR_NUMBER=$(echo ${{ github.event.deployment_status.environment_url }} | grep -oP '(?<=pr-)\d+')" >> $GITHUB_ENV + echo "REPO_NAME=${{ github.repository }}" >> $GITHUB_ENV + echo "EXPO_NAME=${{ github.repository }}-$(echo ${{ github.event.deployment_status.environment_url }} | grep -oP '(?<=pr-)\d+')" >> $GITHUB_ENV - name: 🚀 Publish preview working-directory: ./my_project/mobile From d58fe09f2c185355ca862988af86cbdd530820bc Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Thu, 15 Aug 2024 12:33:12 -0500 Subject: [PATCH 57/64] updated channels --- .github/workflows/mobile.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index a10c9b12e..3ee13015d 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -87,16 +87,17 @@ jobs: run: npm install - name: Set Variables - run: - echo "backend_url=${{ github.event.deployment_status.environment_url }}" >> $GITHUB_ENV - echo "PR_NUMBER=$(echo ${{ github.event.deployment_status.environment_url }} | grep -oP '(?<=pr-)\d+')" >> $GITHUB_ENV - echo "REPO_NAME=${{ github.repository }}" >> $GITHUB_ENV - echo "EXPO_NAME=${{ github.repository }}-$(echo ${{ github.event.deployment_status.environment_url }} | grep -oP '(?<=pr-)\d+')" >> $GITHUB_ENV + id: set-vars + run: | + echo "::set-output name=backend_url::${{ github.event.deployment_status.environment_url }}" + echo "::set-output name=PR_NUMBER::$(echo ${{ github.event.deployment_status.environment_url }} | grep -oP '(?<=pr-)\d+')" + echo "::set-output name=REPO_NAME::${{ github.repository }}" + echo "::set-output name=EXPO_NAME::${{ github.repository }}-$(echo ${{ github.event.deployment_status.environment_url }} | grep -oP '(?<=pr-)\d+')" - name: 🚀 Publish preview working-directory: ./my_project/mobile run: | - eas update --branch=${{ env.EXPO_NAME }} --non-interactive --auto + eas update --branch=${{ steps.set-vars.outputs.EXPO_NAME }} --non-interactive --auto env: EXPO_PUBLIC_BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}" EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7" @@ -104,10 +105,10 @@ jobs: - name: Update EAS Config working-directory: ./my_project/mobile run: | - jq --arg pr_number "${{ env.PR_NUMBER }}" '.build["review_" + $pr_number] = { + jq --arg pr_number "${{ steps.set-vars.outputs.PR_NUMBER }}" '.build["review_" + $pr_number] = { "developmentClient": true, "distribution": "internal", - "channel": "", + "channel": "${{ steps.set-vars.outputs.EXPO_NAME }}", "env": { "BACKEND_SERVER_URL": "${{ github.event.deployment_status.environment_url }}", "ROLLBAR_ACCESS_TOKEN": "1a19e5da05b2435b802d5a81aba2bbd7", From fd8e7c6906a5004f09fa25f3b48711ac67772865 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Thu, 15 Aug 2024 13:27:33 -0500 Subject: [PATCH 58/64] remove outputs as it is depcrecated --- .github/workflows/mobile.yml | 14 +++++++------- .../clients/mobile/react-native/Config.js | 4 ---- .../clients/mobile/react-native/eas.json | 4 ---- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index e4935496f..c7717beb5 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -89,15 +89,15 @@ jobs: - name: Set Variables id: set-vars run: | - echo "::set-output name=backend_url::${{ github.event.deployment_status.environment_url }}" - echo "::set-output name=PR_NUMBER::$(echo ${{ github.event.deployment_status.environment_url }} | grep -oP '(?<=pr-)\d+')" - echo "::set-output name=REPO_NAME::${{ github.repository }}" - echo "::set-output name=EXPO_NAME::${{ github.repository }}-$(echo ${{ github.event.deployment_status.environment_url }} | grep -oP '(?<=pr-)\d+')" + echo "backend_url=${{ github.event.deployment_status.environment_url }}" >> $GITHUB_ENV + echo "PR_NUMBER=$(echo ${{ github.event.deployment_status.environment_url }} | grep -oP '(?<=pr-)\d+')" >> $GITHUB_ENV + echo "REPO_NAME=${{ github.repository }}" >> $GITHUB_ENV + echo "EXPO_NAME=${{ github.repository }}-$(echo ${{ github.event.deployment_status.environment_url }} | grep -oP '(?<=pr-)\d+')" >> $GITHUB_ENV - name: 🚀 Publish preview working-directory: ./my_project/mobile run: | - eas update --branch=${{ steps.set-vars.outputs.EXPO_NAME }} --non-interactive --auto + eas update --branch=$EXPO_NAME --non-interactive --auto env: EXPO_PUBLIC_BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}" EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7" @@ -105,10 +105,10 @@ jobs: - name: Update EAS Config working-directory: ./my_project/mobile run: | - jq --arg pr_number "${{ steps.set-vars.outputs.PR_NUMBER }}" '.build["review_" + $pr_number] = { + jq --arg pr_number "$PR_NUMBER" '.build["review_" + $pr_number] = { "developmentClient": true, "distribution": "internal", - "channel": "${{ steps.set-vars.outputs.EXPO_NAME }}", + "channel": "$EXPO_NAME", "env": { "BACKEND_SERVER_URL": "${{ github.event.deployment_status.environment_url }}", "ROLLBAR_ACCESS_TOKEN": "1a19e5da05b2435b802d5a81aba2bbd7", diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/Config.js b/{{cookiecutter.project_slug}}/clients/mobile/react-native/Config.js index 3ec450f69..c6946df68 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/Config.js +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/Config.js @@ -73,7 +73,6 @@ const ENV = () => { } const Config = { ...ENV() } -<<<<<<< HEAD export default Config export const vars = { @@ -84,6 +83,3 @@ export const vars = { rollbarAccessToken, sentryDSN, } -======= -export default Config ->>>>>>> main diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json b/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json index 3dd90abcd..d0f573a1e 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json @@ -52,10 +52,6 @@ "autoIncrement": true, "env": { "BACKEND_SERVER_URL": "", -<<<<<<< HEAD -======= - "BUILD_ENV": "production", ->>>>>>> main "ROLLBAR_ACCESS_TOKEN": "", "SENTRY_DSN": "" } From c3691493a824086c0ec1eb45dd558f0dc506e9dd Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Thu, 15 Aug 2024 13:43:37 -0500 Subject: [PATCH 59/64] test with build --- .github/workflows/mobile.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index c7717beb5..717fa41a3 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -121,8 +121,8 @@ jobs: run: cat eas.json # note: you will need to register your device first using eas device:create & eas credentials to test this - # - name: 🔨 Build & Update App - # working-directory: ./my_project/mobile + - name: 🔨 Build & Update App + working-directory: ./my_project/mobile - # run: | - # eas build --platform ios --profile ${{ env.PR_NUMBER }} && eas update --branch="${{ env.EXPO_NAME }}" --non-interactive --auto + run: | + eas build --platform ios --profile "review_$pr_number" && eas update --branch="${{ env.EXPO_NAME }}" --non-interactive --auto From 010c2f00b6105eb63ace1c0688142278c7366373 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Thu, 15 Aug 2024 16:33:42 -0500 Subject: [PATCH 60/64] fix binding for channel --- .github/workflows/mobile.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 717fa41a3..b214ffa9b 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -92,12 +92,12 @@ jobs: echo "backend_url=${{ github.event.deployment_status.environment_url }}" >> $GITHUB_ENV echo "PR_NUMBER=$(echo ${{ github.event.deployment_status.environment_url }} | grep -oP '(?<=pr-)\d+')" >> $GITHUB_ENV echo "REPO_NAME=${{ github.repository }}" >> $GITHUB_ENV - echo "EXPO_NAME=${{ github.repository }}-$(echo ${{ github.event.deployment_status.environment_url }} | grep -oP '(?<=pr-)\d+')" >> $GITHUB_ENV + echo "EXPO_CHANNEL=${{ github.repository }}-$(echo ${{ github.event.deployment_status.environment_url }} | grep -oP '(?<=pr-)\d+')" >> $GITHUB_ENV - name: 🚀 Publish preview working-directory: ./my_project/mobile run: | - eas update --branch=$EXPO_NAME --non-interactive --auto + eas update --branch=$EXPO_CHANNEL --non-interactive --auto env: EXPO_PUBLIC_BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}" EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7" @@ -105,10 +105,10 @@ jobs: - name: Update EAS Config working-directory: ./my_project/mobile run: | - jq --arg pr_number "$PR_NUMBER" '.build["review_" + $pr_number] = { + jq --arg pr_number "$PR_NUMBER" --arg expo_channel "$EXPO_CHANNEL"'.build["review_" + $pr_number] = { "developmentClient": true, "distribution": "internal", - "channel": "$EXPO_NAME", + "channel": "$expo_channel", "env": { "BACKEND_SERVER_URL": "${{ github.event.deployment_status.environment_url }}", "ROLLBAR_ACCESS_TOKEN": "1a19e5da05b2435b802d5a81aba2bbd7", @@ -125,4 +125,4 @@ jobs: working-directory: ./my_project/mobile run: | - eas build --platform ios --profile "review_$pr_number" && eas update --branch="${{ env.EXPO_NAME }}" --non-interactive --auto + eas build --platform ios --profile "review_$pr_number" && eas update --branch="${{ env.EXPO_CHANNEL }}" --non-interactive --auto From 29629b5cf7c563a4953b97e2a26c9a287af796af Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Thu, 15 Aug 2024 17:26:02 -0500 Subject: [PATCH 61/64] fix binding for channel --- .github/workflows/mobile.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index b214ffa9b..aa1e6897e 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -105,10 +105,10 @@ jobs: - name: Update EAS Config working-directory: ./my_project/mobile run: | - jq --arg pr_number "$PR_NUMBER" --arg expo_channel "$EXPO_CHANNEL"'.build["review_" + $pr_number] = { + jq --arg pr_number "$PR_NUMBER" --arg expo_channel "$EXPO_CHANNEL" '.build["review_" + $pr_number] = { "developmentClient": true, "distribution": "internal", - "channel": "$expo_channel", + "channel": $expo_channel, "env": { "BACKEND_SERVER_URL": "${{ github.event.deployment_status.environment_url }}", "ROLLBAR_ACCESS_TOKEN": "1a19e5da05b2435b802d5a81aba2bbd7", From d891503267d916c5be522d18e8e61d3fad0dd1e2 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Thu, 15 Aug 2024 17:43:35 -0500 Subject: [PATCH 62/64] fix env var --- .github/workflows/mobile.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index aa1e6897e..dd488ca24 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -91,9 +91,8 @@ jobs: run: | echo "backend_url=${{ github.event.deployment_status.environment_url }}" >> $GITHUB_ENV echo "PR_NUMBER=$(echo ${{ github.event.deployment_status.environment_url }} | grep -oP '(?<=pr-)\d+')" >> $GITHUB_ENV - echo "REPO_NAME=${{ github.repository }}" >> $GITHUB_ENV - echo "EXPO_CHANNEL=${{ github.repository }}-$(echo ${{ github.event.deployment_status.environment_url }} | grep -oP '(?<=pr-)\d+')" >> $GITHUB_ENV - + echo "REPO_NAME=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9._-]//g')" >> $GITHUB_ENV + echo "EXPO_CHANNEL=$(echo ${{ github.repository }}-$(echo ${{ github.event.deployment_status.environment_url }} | grep -oP '(?<=pr-)\d+') | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9._-]//g')" >> $GITHUB_ENV - name: 🚀 Publish preview working-directory: ./my_project/mobile run: | @@ -125,4 +124,4 @@ jobs: working-directory: ./my_project/mobile run: | - eas build --platform ios --profile "review_$pr_number" && eas update --branch="${{ env.EXPO_CHANNEL }}" --non-interactive --auto + eas build --platform ios --profile "review_$pr_number" && eas update --branch="$EXPO_CHANNEL" --non-interactive --auto From e01f7297b5d4f4e6f09b4dd4cf9fdc7c40154059 Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Thu, 15 Aug 2024 18:09:11 -0500 Subject: [PATCH 63/64] fix build command --- .github/workflows/mobile.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index dd488ca24..f7a8b0440 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -124,4 +124,4 @@ jobs: working-directory: ./my_project/mobile run: | - eas build --platform ios --profile "review_$pr_number" && eas update --branch="$EXPO_CHANNEL" --non-interactive --auto + eas build --platform ios --profile review_${PR_NUMBER} && eas update --branch=$EXPO_CHANNEL --non-interactive --auto From 052865882532a50881dfda9537c52edbd19899ac Mon Sep 17 00:00:00 2001 From: Pari Work Temp Date: Tue, 20 Aug 2024 15:30:18 -0500 Subject: [PATCH 64/64] check if the issue is related to the profile --- .github/workflows/mobile.yml | 3 ++- CONTRIBUTING.md | 22 +++++++++++++++++++ resources/app.config.vars.txt | 4 ++-- resources/eas.vars.txt | 2 +- .../clients/mobile/react-native/README.md | 4 +++- .../clients/mobile/react-native/eas.json | 1 - 6 files changed, 30 insertions(+), 6 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index f7a8b0440..460099764 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -123,5 +123,6 @@ jobs: - name: 🔨 Build & Update App working-directory: ./my_project/mobile + # eas build --platform ios --profile review_${PR_NUMBER} && eas update --branch=$EXPO_CHANNEL --non-interactive --auto run: | - eas build --platform ios --profile review_${PR_NUMBER} && eas update --branch=$EXPO_CHANNEL --non-interactive --auto + eas build --platform ios --profile production && eas update --branch=production --non-interactive --auto diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 73aa2a925..18a9159e0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -78,3 +78,25 @@ tox -e py -- -k test_default_configuration [`pytest-cookies`]: https://pypi.python.org/pypi/pytest-cookies/ [`flake8`]: https://pypi.python.org/pypi/flake8/ [`PyPI`]: https://pypi.python.org/pypi + + +### Testing Review App Builds + +Each build will first run `expo update` to create a testable version of your app in Expo Go for reviewers to test. Expo updates are typically quick and can allow testing of most functionality. When there is a need to test native code or React Native code that has not been ported to expo you will need to try out the development build. + +Each push will also create a development build as well. This development build can be installed on any device and allows the user to test. + +For iOS you will need to register your device and generate a new profile and then rebuild the app by commiting a change. + + +1. Visit the GH actions tag +2. Copy the eas.json that was created by the build +3. Paste it into your project +4. You will also need to refill the app.config.js + ``` + /scripts/setup_mobile_config.sh /tn-spa-bootstrapper/{{cookiecutter.project_slug}}/clients/mobile/react-native/app.config.js /tn-spa-bootstrapper/resources/app.config.vars.txt + ``` +5. run eas device:create if you have never added your device before +6. run eas credentials and select the new configuration for your device +7. Push a change to trigger the build! + diff --git a/resources/app.config.vars.txt b/resources/app.config.vars.txt index f1d3456c0..16289048c 100644 --- a/resources/app.config.vars.txt +++ b/resources/app.config.vars.txt @@ -3,6 +3,6 @@ REPLACE_WITH_EXPO_APP_NAME=tn mobile bootstrapper REPLACE_WITH_EXPO_APP_SLUG=tn-sample-app REPLACE_WITH_EXPO_OWNER=thinknimble-bootstrapper REPLACE_WITH_EXPO_APP_ID=ec1b86e2-2582-48cf-8a7a-c6d2772ba4f2 -REPLACE_WITH_SENTRY_ORG=tn-bootstrapper +REPLACE_WITH_SENTRY_ORG=tn-spa REPLACE_WITH_IOS_BUNDLE_ID=org.thinknimble.expo.bootstrapper -REPLACE_WITH_ANDROID_PACKAGE_ID=com.example.app +REPLACE_WITH_ANDROID_PACKAGE_ID=com.example.app \ No newline at end of file diff --git a/resources/eas.vars.txt b/resources/eas.vars.txt index 038e4e8eb..e6b70720f 100644 --- a/resources/eas.vars.txt +++ b/resources/eas.vars.txt @@ -14,5 +14,5 @@ REPLACE_WITH_APPSTORE_CONNECT_APP_NAME=TN Bootsrapper RN REPLACE_WITH_APPLE_ID_EMAIL_SIGNING_APP=pari@thinknimble.com REPLACE_WITH_APPLESTORE_CONNECT_ID=6446805695 REPLACE_WITH_APPLE_TEAM_ID=6BNA6HFF6B -REPLACE_WITH_REVIEW_APP_SENTRY_PROJECT_NAME=tn-bootsrapper-rn +REPLACE_WITH_REVIEW_APP_SENTRY_PROJECT_NAME=tn-spa-staging diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/README.md b/{{cookiecutter.project_slug}}/clients/mobile/react-native/README.md index e1aad464c..eabfcdd41 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/README.md +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/README.md @@ -133,7 +133,9 @@ Recreate the provisioning profile <- **this step is required in order for the us Rebuild the app <- **this step is required in order for the user to be able to install the app** -You must run a first time production build to set up appstore connect keys to be managed by Expo +You must run a first time production build, locally to set up appstore connect keys to be managed by Expo + +`eas build --profile production` **Google** diff --git a/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json b/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json index d0f573a1e..051a1ab13 100644 --- a/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json +++ b/{{cookiecutter.project_slug}}/clients/mobile/react-native/eas.json @@ -21,7 +21,6 @@ "env": { "BACKEND_SERVER_URL": "", "ROLLBAR_ACCESS_TOKEN": "", - "SENTRY_PROJECT_NAME": "", "SENTRY_DSN": "" } },