美文网首页
jenkins脚本

jenkins脚本

作者: Shineyok | 来源:发表于2019-10-17 13:23 被阅读0次

# 工程名

APP_NAME=""

# 证书

CODE_SIGN_DISTRIBUTION=""

# info.plist路径

project_infoplist_path="./${APP_NAME}/Info.plist"

project_infoplist_path="绝对地址"

#取版本号

bundleShortVersion=$(/usr/libexec/PlistBuddy -c "print CFBundleShortVersionString" "${project_infoplist_path}")

#取build值

bundleVersion=$(/usr/libexec/PlistBuddy -c "print CFBundleVersion" "${project_infoplist_path}")

DATE="$(date +%Y%m%d)"

IPANAME="${APP_NAME}_V${bundleShortVersion}_${DATE}.ipa"

#要上传的ipa文件路径,这里我将ipa包放在用户目录下的archive文件夹中

IPA_PATH="$HOME/archive/${IPANAME}"

echo ${IPA_PATH}

echo "${IPA_PATH}">> text.txt

#获取权限

security unlock-keychain -p "密码" $HOME/Library/Keychains/login.keychain

# //下面2行是没有Cocopods的用法

# echo "=================clean================="

# xcodebuild -target "${APP_NAME}"  -configuration 'Release' clean

# echo "+++++++++++++++++build+++++++++++++++++"

# xcodebuild -target "${APP_NAME}" -sdk iphoneos -configuration 'Release' CODE_SIGN_IDENTITY="${CODE_SIGN_DISTRIBUTION}" SYMROOT='$(PWD)'

WORKSPACE_PATH="绝对地址xcworkspace"

#//下面2行是集成有Cocopods的用法

#echo "=================clean================="

#xcodebuild -workspace "绝对地址xcworkspace" -scheme "${APP_NAME}"  -configuration 'Debug' clean

#echo "+++++++++++++++++build+++++++++++++++++"

#xcodebuild -workspace "绝对地址xcworkspace" -scheme "${APP_NAME}" -sdk iphoneos -configuration 'Debug' CODE_SIGN_IDENTITY="${CODE_SIGN_DISTRIBUTION}" SYMROOT='$(PWD)'-UseModernBuildSystem=NO

xcodebuild -workspace ${WORKSPACE_PATH} -scheme "${APP_NAME}" -configuration 'Release' clean

echo "+++++++++++++++++Build+++++++++++++++++"

xcodebuild -workspace ${WORKSPACE_PATH} -scheme "${APP_NAME}" -sdk iphoneos -configuration 'Release' CODE_SIGN_IDENTITY="${CODE_SIGN_DISTRIBUTION}" SYMROOT='$(SYMROOT)'-UseModernBuildSystem=NO

echo "+++++++++++++++++Run+++++++++++++++++"

#xcodebuild -configuration "${CONFIGURATION}" -project "${PROJECT_NAME}.xcodeproj" -target "${TARGET_NAME}" -sdk "${OTHER_SDK_TO_BUILD}" ${ACTION} RUN_CLANG_STATIC_ANALYZER=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" SYMROOT="${SYMROOT}" -UseModernBuildSystem=NO

#//打包输出ipa

#xcrun -sdk iphoneos PackageApplication "./Release-iphoneos/${APP_NAME}.app" -o ${IPA_PATH}

#xcrun -sdk iphoneos PackageApplication "./build/Release-iphoneos/${APP_NAME}.app" -o ${IPA_PATH}

xcrun -sdk iphoneos xcodebuild -exportArchive -archivePath "./build/Release-iphoneos/${APP_NAME}.app" --exportPath "${TARGET_NAME}"/info.plist -archivePath ${IPA_PATH}

#xcodebuild -exportArchive -archivePath \${build_path}/${project_name}.xcarchive \-configuration ${development_mode} \-exportPath ${exportIpaPath}

#上传到蒲公英

uKey="xxxxx"

#蒲公英上的API Key

apiKey="xx"

#蒲公英版本更新描述,这里取git最后一条提交记录作为描述

MSG=`git log -1 --pretty=%B`

#要上传的ipa文件路径

echo $IPA_PATH

#执行上传至蒲公英的命令

echo "++++++++++++++upload+++++++++++++"

curl -F "file=@${IPA_PATH}" -F "uKey=${uKey}" -F "_api_key=${apiKey}" -F "buildUpdateDescription=${MSG}" http://www.pgyer.com/apiv2/app/upload

相关文章

网友评论

      本文标题:jenkins脚本

      本文链接:https://www.haomeiwen.com/subject/tlbmmctx.html