Skip to content

Instantly share code, notes, and snippets.

@stevehanson
Created November 4, 2022 16:14
Show Gist options
  • Save stevehanson/d49362d16e8c09afb65e252fd5d0e97e to your computer and use it in GitHub Desktop.
Save stevehanson/d49362d16e8c09afb65e252fd5d0e97e to your computer and use it in GitHub Desktop.
React Native bin/setup
#!/bin/bash
#
# Script to be run on new project setup. Run with `bin/setup`. Does the following:
#
# * Installs ENV and key files from 1Password (does not overwrite existing)
# * Runs bundle install, yarn install
# * Sets project environment to 'staging'
downloadFile() {
if [ -e $1 ]
then
echo "✅ $1 exists, not overwriting"
else
echo "Downloading $1 file"
op document get "$2" --output=$1
fi
}
echo "Installing ENV files and keys"
ACCOUNTS=$(op account list)
if [ -z "${ACCOUNTS}" ]; then
echo '-----------------------------------------------------'
echo 'No accounts configured for use with 1Password CLI.'
echo 'You can either:'
echo ' - Sign in to authorize the CLI with biometric unlock; see https://developer.1password.com/docs/cli/get-started/#sign-in for details.'
echo ' - Add an account manually with `op account add`; see `op account add --help` for details.'
echo ''
echo 'After configuring the CLI for 1Password account access, run this script again.'
echo '-----------------------------------------------------'
exit 1
fi
downloadFile ".env" "My app .env"
downloadFile "fastlane/.env" "My app fastlane/.env"
downloadFile "android/app/play-store-credentials.json" "My app Google Play Service Account"
downloadFile "android/app/upload-key.keystore" "My app upload key keystore"
echo "Installing JavaScript dependencies"
yarn install
echo "Setting back-end environment to staging"
yarn env staging
echo "Installing Ruby dependencies"
bundle install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment