Jenkins xcode 打包 上传蒲公英

cd /Users/Shared/Jenkins/Home/workspace/新版跑跑

#xxx是工程名

if [ ! -d ./IPADir ];

then

mkdir -p IPADir;

fi

if [ ! -d ./build ];

then

mkdir -p build;

fi

security unlock-keychain -p "1234" ~/Library/Keychains/login.keychain

#工程绝对路径

project_path=/Users/Shared/Jenkins/Home/workspace/新版跑跑

#工程名 将XXX替换成自己的工程名

project_name=新版跑跑

#scheme名 将aaa替换成自己的sheme名

scheme_name=Runner

#打包模式 Debug/Release

development_mode=Debug

#build文件夹路径

build_path=${project_path}/build

#plist文件所在路径

exportOptionsPlistPath=${project_path}/ExportOptions.plist

#导出.ipa文件所在路径

exportIpaPath=${project_path}/IPADir/${development_mode}

      echo '///-----------'

      echo '/// 正在清理工程'

      echo '///-----------'

      #xcodebuild \

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

      xcodebuild -workspace ${project_path}/${scheme_name}.xcworkspace -scheme ${scheme_name} -configuration Release clean

      echo '///--------'

      echo '/// 清理完成'

      echo '///--------'

      echo ''

      echo '///-----------'

      echo '/// 正在编译工程:'${development_mode}

      echo '///-----------'

      xcodebuild \

      archive -workspace ${project_path}/${scheme_name}.xcworkspace \

      -scheme ${scheme_name} \

      -configuration ${development_mode} \

      -archivePath ${build_path}/${scheme_name}.xcarchive  -quiet  || exit

      echo '///--------'

      echo '/// 编译完成'

      echo '///--------'

      echo ''

    echo '///----------'

    echo '/// 开始ipa打包'

    echo '///----------'

    xcodebuild -exportArchive -archivePath ${build_path}/${scheme_name}.xcarchive \

    -configuration ${development_mode} \

    -exportPath ${exportIpaPath} \

    -exportOptionsPlist ${exportOptionsPlistPath} \

    -allowProvisioningUpdates \

    -quiet || exit

    if [ -e $exportIpaPath/$scheme_name.ipa ]; then

    echo '///----------'

    echo '/// ipa包已导出'

    echo '///----------'

    else

    echo '///-------------'

    echo '/// ipa包导出失败 '

    echo '///-------------'

    fi

    echo '///------------'

    echo '/// 打包ipa完成  '

    echo '///-----------='

    echo ''

    echo "开始上传到蒲公英"

#上传到蒲公英

#描述信息

des="修改一些bug"

echo "des:+$des"

packageTime="打包时间:【`date \"+%Y-%m-%d %H:%M:%S\"`】---"

echo $packageTime

#蒲公英aipKey

MY_PGY_API_K="dce54dd23345f6b59f1b684623e83e63"

#蒲公英uKey

MY_PGY_UK="a50db512f59be9edc27fbd882bf7cf25"

curl -F "file=@${exportIpaPath}/${scheme_name}.ipa" \

-F "installType=2" \

-F "password=123456" \

-F "buildUpdateDescription=${packageTime}${des}" \

-F "uKey=${MY_PGY_UK}" \

-F "_api_key=${MY_PGY_API_K}" \

https://www.pgyer.com/apiv1/app/upload

你可能感兴趣的:(Jenkins xcode 打包 上传蒲公英)