使用 Jenkins 自动化打包iOS

1、安装fastlane, https://fastlane.tools/  

        sudo gem install fastlane -NV   此方式有时出现错误

        brew cask install fastlane  此电脑是用的后者

sudo gem install -n /usr/local/bin fastlane 也有用这种方式的

2、java -jar jenkins.war --httpPort=8080

打开http://locallhost:8080

根据https://www.pgyer.com/doc/view/jenkins_ios蒲公英文档设置jenkins的git/SVN,设置打包shell

3、打开jenkins目录中的打包文件夹,确定可以正常运行。

4、在XCode中设置Command Line Tools,否则会出现不能定位XCode的错误。


 ——————————————— 下面脚本可用  ———————————————————

——————— ———————

Jenkins

蒲公英文档集成Jenkins实现持续集成iOS

—————————————  delete jenkins  ———————————————

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist

sudo rm !$

sudo rm -rf /Applications/Jenkins "/Library/Application Support/Jenkins" /Library/Documentation/Jenkins

sudo rm -rf /Users/Shared/Jenkins

# if you want to get rid of all the jobs and builds:

sudo dscl . -delete /Users/jenkins

# delete the jenkins user and group (if you chose to use them):

sudo dscl . -delete /Groups/jenkins

 ———————————  XCode中配置打包时版本号加1  —————————————


#!/bin/bash

echo $CONFIGURATION

if [ "Release" == "${CONFIGURATION}" ]

then

buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")

buildNumber=$(($buildNumber + 1))

/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"

echo "build number increase"

fi

先安装fastlane和jekins

 ——————————————— 下面脚本可用  ———————————————————

#!/bin/bash

#!echo $CONFIGURATION

#!if [ "Release" == "${CONFIGURATION}" ]

#!then

IPANAME="UnoKiwi"

# info.plist路径

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

buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${project_infoplist_path}")

buildNumber=$(($buildNumber + 1))

/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${project_infoplist_path}"

echo "build number increase"

#!fi


fastlane gym --export_method development --output_name ${IPANAME}

#蒲公英上的User Key

uKey="a9409159ffc8972a43a1c06c039xxxxx"

#蒲公英上的API Key

apiKey="eee58300f0f02b87b4a62703afdxxxxx"

curl -F "file=@${IPANAME}.ipa" -F "uKey=${uKey}" -F "_api_key=${apiKey}"http://www.pgyer.com/apiv1/app/upload

你可能感兴趣的:(使用 Jenkins 自动化打包iOS)