Created
November 29, 2019 01:53
-
-
Save phuochau/77264f101ed1a3f83a49c560ea3eac16 to your computer and use it in GitHub Desktop.
Bash script to read version in package.json and set it for Info.plist in React Native Project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PROJECT_DIR="ios/Invygo" | |
INFOPLIST_FILE="Info.plist" | |
INFOPLIST_DIR="${PROJECT_DIR}/${INFOPLIST_FILE}" | |
PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') | |
# Update plist with new values | |
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${PACKAGE_VERSION#*v}" "${INFOPLIST_DIR}" | |
git add "${INFOPLIST_DIR}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment