xcodebuild auto package script and auto upload dandelion script

https://github.com/potato512/SYIPAGeneratedScript


The script file "xxx.sh" is edited with the "Sublime_Text" tool.

The command when executing the script in the terminal: sh xxx.sh


# Script function description

# In the terminal, use xcodebuild for automatic packaging and uploading to Dandelion
#
# Usage steps:
# 1 Directory configuration (package upload directory, project directory)
# 2 Project configuration (version, name, certificate, description file UUID, description file, archive Save directory, ipa save directory)
# 3 Delete old files
# 4 Clear old projects
# 5 Generate archive
# 6 Generate ipa
# 7 Upload ipa to Dandelion (upload path, userKey, apiKey)

#


Note: The following sample code can be used normally, you need to modify the configuration to your own information before use. Such as package upload directory upload_path, project directory target_path, project name target_name, certificate name codeSignIdentity, description file provisioning_profile, description file UUIDprovision_UUID, and the file address file when uploading to Dandelion.


# 1 directory (package upload directory; project directory)
upload_path="/Users/zsy/Desktop/uploadIPA"
target_path="/Users/zsy/Desktop/iOSTest"

echo "upload_path package path: $upload_path"
echo "target_path project path: $target_path"
# 2 Configuration information Release version
configuration="Release"

# project name
target_name="iOSTest"
project_name="${project_name}.xcodeproj"
workspace_name="${target_name}.xcworkspace"
scheme="$target_name"

echo "configuration配置:$configuration"
echo "target_name project name: $target_name"
echo "workspace_nameworkspace name:$workspace_name"
echo "scheme名称:$scheme"

# Use certificate and description file UUID for archive package; use description file (description file name) for ipa package
codeSignIdentity="iPhone Developer: zsy Test (5DD779QQBQ)"
provision_UUID="06b7492h-083a-4313-c633-15de685929q4"
provisoning_profile="iOSTestDevelopProfile"

echo "codeSignIdentity development certificate: $codeSignIdentity"
echo "provision_UUID description file UUID:$provision_UUID"
echo "provisoning_profile description file: $provisoning_profile"

# Storage directory (you can modify the user name "zsy" on different computers)
# project_dir = `pwd`
# echo "project_dir directory: $project_dir"

# XCODE_PRJ="xcodeproj"
# FILE_EXTENSION='xcworkspace'
# PROJECT_DIR = `pwd`
# CD_XCODE_PRJ=`pwd`/$PROJECT_NAME.$XCODE_PRJ
# PROJECT_WORKSPACE=$PROJECT_DIR.
# PROJECT_BUILD=`pwd`/$PROJECT_NAME/BUILD

# When entering the project directory
# ipa_path="archive/${target_name}.ipa"
# archive_path="archive/${target_name}.xcarchive"
# log_path="./archive/log.txt"

# When specifying a directory
cd "$upload_path"
ipa_path="$upload_path/${target_name}.ipa"
archive_path="$upload_path/${target_name}.xcarchive"
log_path="$upload_path/log.txt"

pwd
echo "ipa_path export path: $ipa_path"
echo "archive_path generation path: $archive_path"
echo "log_path print path: $log_path"
#3 delete old files
rm -rf "$log_path"
rm -rf "$archive_path"
rm -rf "$ipa_path"
cd "$target_path"
pwd
# 4 Clean the build directory
# xcodebuild clean -configuration "$configuration" -alltargets
xcodebuild clean -configuration "$configuration" -alltargets >> $log_path
# 5 Archive (if other parameters are not specified, the configuration in the .xcworkspace or .xcodeproj file is used by default)
xcodebuild archive -workspace "$workspace_name" -scheme "$scheme" -configuration "$configuration" -archivePath "$archive_path" CODE_SIGN_IDENTITY="$codeSignIdentity" PROVISIONING_PROFILE="$provision_UUID" >> $log_path
# 6 Guided IPA
xcodebuild -exportArchive -exportFormat IPA -archivePath "$archive_path" -exportPath "$ipa_path"  -exportProvisioningProfile "$provisoning_profile" >> $log_path
#7 Upload IPA to Dandelion
curl -F "file=@/Users/zsy/Desktop/uploadIPA/iOSTest.ipa" \
-F "uKey=a512b58c56285d23456e011fgh706509" \
-F "_api_key=ab9c240d2efg9hi17j9642k3l5mnop5q" \
https://www.pgyer.com/apiv1/app/upload











Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325847083&siteId=291194637