Created
June 28, 2019 13:02
-
-
Save falcon11/9c538f674cbe3f5465c1c1ba3511962b to your computer and use it in GitHub Desktop.
auto generate ipa
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 | |
BuidPath=build/`date +%F-%T` | |
ProjectName=HNPositionAsst | |
Configuration=Release | |
ExportOptionsPlist=ExportOptions.plist | |
IPA_NAME=app | |
mkdir -p $BuidPath | |
archivePath=$BuidPath/$ProjectName.xcarchive | |
# archive | |
xcodebuild archive -project $ProjectName.xcodeproj \ | |
-scheme $ProjectName \ | |
-configuration $Configuration \ | |
-archivePath $archivePath | |
# export ipa | |
xcodebuild -exportArchive -archivePath $archivePath \ | |
-exportOptionsPlist $ExportOptionsPlist \ | |
-exportPath $BuidPath | |
VERSION_STRING=$(/usr/libexec/PlistBuddy -c "Print ApplicationProperties:CFBundleShortVersionString" $archivePath/Info.plist) | |
echo $VERSION_STRING | |
BUNDLE_VERSION=$(/usr/libexec/PlistBuddy -c "Print ApplicationProperties:CFBundleVersion" $archivePath/Info.plist) | |
echo $BUNDLE_VERSION | |
ipaPath=$BuidPath/$ProjectName.ipa | |
newIpaPath=$BuidPath/$IPA_NAME | |
if [ $VERSION_STRING ]; then | |
newIpaPath=$newIpaPath-$VERSION_STRING | |
fi | |
if [ $BUNDLE_VERSION ]; then | |
newIpaPath=$newIpaPath\($BUNDLE_VERSION\).ipa | |
mv $ipaPath $newIpaPath | |
fi | |
rm -rf $archivePath |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment