#! /bin/Bashproject_path=$(dirname$0) Project_config=Releaseoutput_path=~/Desktopbuild_scheme=Ykticketsappworkspace_name=Ykticketsappparameter=":p: c:o:s:w:h:" whilegetopts $parameter optname Do Case "$optname" inch "P") Project_path=$OPTARG;; "C") Project_config=$OPTARG;; "o") Output_path=$OPTARG;; "s") Build_scheme=$OPTARG;; "W") workspace_name=$OPTARG;; "h" ) Echo "-P project path, default to the current path" Echo "- C Fixed plate configuration name, default is release" Echo "- o Packaging output path, default to Desktop" Echo "- S Package usage policy, default to Ykticketsapp" Echo "- w Package workspace name, default is Ykticketsapp"Exit - ;; * ) Echo "Invalid parameter" Echo "-P project path, default to the current path" Echo "- C Fixed plate configuration name, default is release" Echo "- o Packaging output path, default to Desktop" Echo "- S Package usage policy, default to Ykticketsapp" Echo "- w Package workspace name, default is Ykticketsapp"Exit + ;; Esac DoneWorkspace_file="${project_path}/${workspace_name}.xcworkspace"Date_time="$ (date +"%y%m%d_%h%m%s")"Archive_file="${output_path}/${date_time}_${project_config}.xcarchive"Ipa_file="${output_path}/${date_time}_${project_config}.ipa"#cd $project _path#pod_cmd='pod update--verbose--no-repo-update'# $pod _cmd#clean_cmd="xcodebuild Clean"#clean_cmd="${clean_cmd}-workspace ${workspace_file}"#clean_cmd="${clean_cmd}-scheme ${build_scheme}"#clean_cmd="${clean_cmd}-configuration ${project_config}"#Echo${clean_cmd}# $clean _cmd#if[$?-ne 0]; Then# Echo "The cleanup project failed, please check the project. "# Exit -#fi#xcc='/users/ykse/desktop/iphone/channelconfig/hongtan/yk_hongditan_enterprise.xcconfig'#sign='iPhone Distribution:ykse Co., Ltd.'#pf='92d73c46-f9f5-4e7f-b37c-11f933dbe395'Build_cmd="xcodebuild-workspace ${workspace_file}"Build_cmd="${build_cmd}-scheme ${build_scheme}"Build_cmd="${build_cmd}-destination Generic/platform=ios archive"Build_cmd="${build_cmd}-configuration ${project_config}"Build_cmd="${build_cmd} only_active_arch=no-archivepath ${archive_file}"#build_cmd="${build_cmd} code_sign_identity=${sign}"#build_cmd="${build_cmd} PROVISIONING_PROFILE=${PF}"Echo${build_cmd} $build _cmdif[$?-ne0]; Then Echo "failed to build the project, please check the project. "Exit tofiRun_cmd="XCRUN-SDK Iphoneos"Run_cmd="${run_cmd} packageapplication-v"Run_cmd="${run_cmd} ${archive_file}/products/applications/ykticketsapp.app"Run_cmd="${run_cmd}-o ${ipa_file}"Echo${run_cmd} $run _cmdif[$?-ne0]; Then Echo "The package project failed, please check the project. "Exit +fi
iOS Shell Packaging script Xcodebuild