# Use method

if [ ! -d ./ipaPackage ];

then

mkdir -p ipaPackage;

fi

# Engineering absolute path

project_path=(**cd** \`dirname 0 `; pwd)

Replace XXX with your own project name

project_name=HRZ

#scheme name replaces XXX with your own sheme name

Scheme_name = “e province”

Package mode Debug/Release

development_mode=Debug

#build folder path

build_path=${project_path}/ipaPackage/build

# path to the plist file

exportOptionsPlistPath=${project_path}/ExportOptions.plist

#echo “Place enter the number you want to export ? [ 1:app-store 2:ad-hoc] “

#read number

#while([[ number != 1 \]\] && \[\[ number != 2 ]])

#do

#echo “Error! Should enter 1 or 2”

#echo “Place enter the number you want to export ? [ 1:app-store 2:ad-hoc] “

#read number

#done

number=2;

if [ $1 == dis ]

then

Echo “package environment dis environment release environment

number=1

else

number=2

Echo “Package dev environment Debug environment”

fi

devExportOptionsPath=${project_path}/ipaPackage/devExportOptions.plist

disExportOptionsPath=${project_path}/ipaPackage/disExportOptions.plist

if [ $number == 1 ]; then

development_mode=Release

exportOptionsPlistPath=$disExportOptionsPath

else

development_mode=Debug

exportOptionsPlistPath=$devExportOptionsPath

fi

Export. Ipa file path

exportIpaPath=
p r o j e c t _ p a t h / i p a P a c k a g e / {project\_path}/ipaPackage/
{development_mode}

echo ‘///———–‘

Echo ‘// ‘

echo ‘///———–‘

rm -rf build_path

xcodebuild \

clean -configuration ${development_mode} -quiet || exit

echo ‘///——–‘

Echo ‘/// ‘

echo ‘///——–‘

echo

echo ‘///———–‘

Echo ‘/// developing project :’${development_mode}

echo ‘///———–‘

xcodebuild \

archive -workspace
p r o j e c t _ p a t h / {project\_path}/
{project_name}.xcworkspace \

-scheme ${project_name} \

-configuration ${development_mode} \

-archivePath
b u i l d _ p a t h / {build\_path}/
{project_name}.xcarchive -quiet || exit

echo ‘///——–‘

Echo ‘/// compile complete ‘

echo ‘///——–‘

echo

echo ‘///———-‘

Echo ‘/// start ipA package ‘

echo $exportOptionsPlistPath

echo ‘///———-‘

xcodebuild -exportArchive -archivePath
b u i l d _ p a t h / {build\_path}/
{project_name}.xcarchive \

-configuration ${development_mode} \

-exportPath ${exportIpaPath} \

-exportOptionsPlist ${exportOptionsPlistPath} \

-quiet || exit

if [ -e
e x p o r t I p a P a t h / exportIpaPath/
scheme_name.ipa ]; then

echo ‘///———-‘

Echo ‘/// ipA package exported ‘

echo ‘///———-‘

Echo ‘ipA package path’

echo $exportIpaPath

open
e x p o r t I p a P a t h / exportIpaPath/
scheme_name.ipa

else

echo ‘///————-‘

Echo ‘/// failed to export IPA package ‘

echo ‘///————-‘

fi

echo ‘///————‘

Echo ‘/// Package ipA complete ‘

echo ‘///———–=’

echo

echo ‘///————-‘

Echo ‘/// start to publish IPA package ‘

echo ‘///————-‘

#if [ $number == 1 ]; then

# Verify and upload to the App Store

# replace the XXX after -u with your AppleID account, and the XXX after -p with your password

#altoolPath=”/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Versions/A/Support/altool”

# “altoolPath” – – the validate – app – faltoolPath “- validate – app – f AltoolPath “− validate−app− F {exportIpaPath}/${scheme_name}. Ipa -u [email protected] -p Hongrenzhuang1 -t ios –output-format xml

Upload −app−faltoolPath” –upload-app -f altoolPath”− upload−app−f{exportIpaPath}/${scheme_name}. Ipa -u [email protected] -p Hongrenzhuang1 -t ios –output-format xml

## User Key on dandelion

#uKey=”97b4117500e96a773d7ebfbf04aa1f72″

## API Key on dandelion

#apiKey=”2185336c77e9343c1506e0975a9b79a2″

## IpA file path to upload

#IPA_PATH=
e x p o r t I p a P a t h / exportIpaPath/
scheme_name.ipa

#echo ‘Upload production environment package to dandelion’

#echo $IPA_PATH

## Execute upload to dandelion command

# curl – F “file = @ IPA_PATH -” F “uKey = {IPA \ _PATH}” -f “uKey = IPA_PATH” – F “uKey = {uKey}” -f “_api_key = ${apiKey}” www.pgyer.com/apiv1/app/u…

#open -a “/Applications/Safari.app” www.pgyer.com/Mb8a

#else

Upload to Fir

# Replace XXX with your own Fir platform token

#fir login -T ac877788082fd604677295e9429b2ccc

#fir publish
e x p o r t I p a P a t h / exportIpaPath/
scheme_name.ipa

# User Key on dandelion

#uKey=”4a56a43f986279881632e6ad21de6145″

# API Key on dandelion

#apiKey=”11e3bd9614271b4720c954092001b107″

# IpA file path to upload

#IPA_PATH=
e x p o r t I p a P a t h / exportIpaPath/
scheme_name.ipa

#echo ‘Test environment package has been uploaded to dandelion’

#echo $IPA_PATH

# execute upload to dandelion command

# curl – F “file = @ IPA_PATH -” F “uKey = {IPA \ _PATH}” -f “uKey = IPA_PATH” – F “uKey = {uKey}” -f “_api_key = ${apiKey}” www.pgyer.com/apiv1/app/u…

#open -a “/Applications/Safari.app” www.pgyer.com/38im

#fi

#rm -rf build_path

#rm -rf IPA_PATH

exit 0