diff --git a/.github/workflows/deploy_to_firebase.yml b/.github/workflows/deploy_to_firebase.yml index d0c74f1..2b5eef0 100644 --- a/.github/workflows/deploy_to_firebase.yml +++ b/.github/workflows/deploy_to_firebase.yml @@ -51,6 +51,11 @@ jobs: echo "$firebase_service_account_base64" | base64 --decode > firebase-distribution-service-account.json echo "CI_EVAL_FIREBASE_DISTRIBUTION_AUTH_FILE=`pwd`/firebase-distribution-service-account.json" >> $GITHUB_ENV + - name: Staging .ENV File + env: + ENV_FILE_CONTENT: ${{ secrets.CI_STAGING_ENV_FILE_CONTENT }} + run: echo "$ENV_FILE_CONTENT" > .env + - name: Deploy to Firebase working-directory: ./android run: bundle exec fastlane deployInternalToFirebase release_notes:"${{ github.event.inputs.releaseNotes }}" @@ -115,9 +120,14 @@ jobs: echo "$ios_cert_base64" | base64 --decode > ios_distribution.p12 echo "CI_EVAL_IOS_CERT_FILE=`pwd`/ios_distribution.p12" >> $GITHUB_ENV + - name: Staging .ENV File + env: + ENV_FILE_CONTENT: ${{ secrets.CI_STAGING_ENV_FILE_CONTENT }} + run: echo "$ENV_FILE_CONTENT" > .env + - name: Deploy to Firebase env: CI_EVAL_IOS_CERT_PASSWORD: ${{ secrets.CI_EVAL_IOS_CERT_PASSWORD }} CI_EVAL_INTERNAL_APP_IDENTIFIER: ${{ secrets.CI_EVAL_INTERNAL_APP_IDENTIFIER }} working-directory: ./ios - run: bundle exec fastlane deployInternalToFirebase release_notes:"${{ github.event.inputs.releaseNotes }}" \ No newline at end of file + run: bundle exec fastlane deployInternalToFirebase release_notes:"${{ github.event.inputs.releaseNotes }}" diff --git a/.github/workflows/deploy_to_playstore_testflight.yml b/.github/workflows/deploy_to_playstore_testflight.yml index e68e34a..bba95de 100644 --- a/.github/workflows/deploy_to_playstore_testflight.yml +++ b/.github/workflows/deploy_to_playstore_testflight.yml @@ -52,6 +52,12 @@ jobs: run: | echo "$play_store_service_account_base64" | base64 --decode > play-store-distribution-service-account.json echo "CI_EVAL_ANDROID_PLAY_STORE_AUTH_FILE=`pwd`/play-store-distribution-service-account.json" >> $GITHUB_ENV + + - name: Prod .ENV File + env: + ENV_FILE_CONTENT: ${{ secrets.CI_PROD_ENV_FILE_CONTENT }} + run: echo "$ENV_FILE_CONTENT" > .env + - name: Deploy to Play Store Internal Track env: CI_EVAL_ANDROID_KEYSTORE_KEY_ALIAS: ${{ secrets.CI_EVAL_ANDROID_KEYSTORE_KEY_ALIAS }} @@ -120,6 +126,11 @@ jobs: echo "$app_store_api_key_base64" | base64 --decode > api_key.p8 echo "CI_EVAL_IOS_APP_STORE_KEY_FILE=`pwd`/api_key.p8" >> $GITHUB_ENV + - name: Prod .ENV File + env: + ENV_FILE_CONTENT: ${{ secrets.CI_PROD_ENV_FILE_CONTENT }} + run: echo "$ENV_FILE_CONTENT" > .env + - name: Deploy to TestFlight env: CI_EVAL_IOS_CERT_PASSWORD: ${{ secrets.CI_EVAL_IOS_CERT_PASSWORD }} diff --git a/App.tsx b/App.tsx index 172e52a..53e603a 100644 --- a/App.tsx +++ b/App.tsx @@ -14,6 +14,7 @@ import { useColorScheme, } from 'react-native'; import {Colors} from './src/colors'; +import {MY_ENV_VAR} from '@env'; function App(): JSX.Element { const isDarkMode = useColorScheme() === 'dark'; @@ -32,7 +33,7 @@ function App(): JSX.Element { backgroundColor={backgroundStyle.backgroundColor} /> - {'hello world'} + {`hello world ${MY_ENV_VAR}`} ); diff --git a/babel.config.js b/babel.config.js index f842b77..0bfc727 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,3 +1,4 @@ module.exports = { presets: ['module:metro-react-native-babel-preset'], + plugins: ['module:react-native-dotenv'], }; diff --git a/package-lock.json b/package-lock.json index 055dfa8..e9ab5f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,6 +25,7 @@ "jest": "^29.2.1", "metro-react-native-babel-preset": "0.76.8", "prettier": "^2.4.1", + "react-native-dotenv": "^3.4.9", "react-test-renderer": "18.2.0", "typescript": "4.8.4" }, @@ -5735,6 +5736,18 @@ "node": ">=6.0.0" } }, + "node_modules/dotenv": { + "version": "16.3.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", + "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/motdotla/dotenv?sponsor=1" + } + }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -10657,6 +10670,18 @@ "react": "18.2.0" } }, + "node_modules/react-native-dotenv": { + "version": "3.4.9", + "resolved": "https://registry.npmjs.org/react-native-dotenv/-/react-native-dotenv-3.4.9.tgz", + "integrity": "sha512-dbyd+mcy7SUzxEgmt33TRf1FGcNe6swJhXmB0unKkI49F7+pidog9kPtjxMLTAfmKA8gcN2XHQSKltGfGbGCLQ==", + "dev": true, + "dependencies": { + "dotenv": "^16.3.1" + }, + "peerDependencies": { + "@babel/runtime": "^7.20.6" + } + }, "node_modules/react-native/node_modules/@jest/types": { "version": "26.6.2", "resolved": "https://registry.npmjs.org/@jest/types/-/types-26.6.2.tgz", diff --git a/package.json b/package.json index ed0512d..f0c3ce7 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,8 @@ "metro-react-native-babel-preset": "0.76.8", "prettier": "^2.4.1", "react-test-renderer": "18.2.0", - "typescript": "4.8.4" + "typescript": "4.8.4", + "react-native-dotenv": "^3.4.9" }, "engines": { "node": ">=16"