Created
December 1, 2017 08:35
-
-
Save whck6/b1d12e06844cbf08ae7dfa088e306fad to your computer and use it in GitHub Desktop.
超陽春版 React Native for iOS 自動打包上傳到 TestFlight
This file contains hidden or 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/sh | |
TARGET_NAME=$1 | |
if [ -n $TARGET_NAME ]; then | |
TARGET_NAME="" | |
fi | |
ROOT_PATH=$HOME/$TARGET_NAME | |
ARCHIVE_DIR=$ROOT_PATH/ios/archive | |
BUNDLE_DIR=$ROOT_PATH/ios/bundle | |
TIME=$(date +"%s") | |
BUNDLE_SHO_VER="1.0" | |
BUNDLE_VER=$TIME | |
USER_NAME="[email protected]" | |
read -s -p "input password of ${USER_NAME}" PASSWORD | |
sleep 1 | |
echo "!!! START BUILD" $TIME | |
if [ -d $BUNDLE_DIR ]; then | |
rm -rf $BUNDLE_DIR | |
fi | |
mkdir -p $BUNDLE_DIR | |
cd $ROOT_PATH | |
react-native bundle --entry-file index.ios.js --platform ios --dev false --bundle-output $BUNDLE_DIR/main.jsbundle --assets-dest $BUNDLE_DIR | |
cd $ROOT_PATH/ios | |
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${BUNDLE_SHO_VER}" $ROOT_PATH/ios/$TARGET_NAME/Info.plist | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${BUNDLE_VER}" $ROOT_PATH/ios/$TARGET_NAME/Info.plist | |
if [ -d $ARCHIVE_DIR ]; then | |
rm -rf $ARCHIVE_DIR | |
fi | |
mkdir -p $ARCHIVE_DIR | |
xcodebuild -scheme $TARGET_NAME clean archive \ | |
-archivePath $ARCHIVE_DIR/$TARGET_NAME.xcarchive \ | |
xcodebuild -exportArchive \ | |
-archivePath $ARCHIVE_DIR/$TARGET_NAME.xcarchive \ | |
-exportPath $ARCHIVE_DIR \ | |
-exportOptionsPlist $ROOT_PATH/BUILD.plist | |
/Applications/Xcode.app/Contents/Applications/Application\ Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool --upload-app -f $ROOT_PATH/ios/archive/$TARGET_NAME.ipa -u $USER_NAME -p $PASSWORD | |
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString 1.0" $ROOT_PATH/ios/ASAPShop/Info.plist | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion 1" $ROOT_PATH/ios/ASAPShop/Info.plist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment