2017/1/2 更新 (加入export ipa及upload to TestFlight shell指令):

1.

(專案設定中的Xcode plugin 點擊 Advanced build settings,展開設定)

 

2.

-archivePath "${WORKSPACE}/archives/Archive.xcarchive"

(設定archive存放的位置,後面的upload ipa 的路徑需與這裡的一樣,需有字串的雙引號包住路徑,以防路徑內有空白名稱造成其它錯誤)

 

3.準備 upload.plist

(XML格式如下)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>teamID</key>
    <string>你的TeamID </string>
    <key>method</key>
    <string>app-store</string>
    <key>uploadBitcode</key>
    <false/>
    <key>uploadSymbols</key>
    <false/>
</dict>
</plist>
 

 

// TeamID 取得方法

(1)  方法1 Prefix

 

(2) 方法2 Xcode 中的Distribution (號碼)

 

4.

ipaPath="${WORKSPACE}/IPA"

ipaFileName="PhotoEditor.ipa"

archivePath="${WORKSPACE}/archives/Archive.xcarchive"

exportOptionsPlist="${WORKSPACE}/export/upload.plist"

username=AppleID

password=密碼

platform="ios"

file="${ipaPath}/${ipaFileName}"

 

xcodebuild -exportArchive -archivePath "${archivePath}" -exportPath "${ipaPath}" -exportOptionsPlist "${exportOptionsPlist}"

chmod -R 777 "${ipaPath}"

/Applications/Xcode.app/Contents/Applications/Application\ Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool --upload-app -f "${file}" -t "${platform}" -u "${username}" -p "${password}"

 

5.

(上傳成功結果圖)

 

 


 2017/1/9 更新 (加入自動遞增Build Version 、Add Tag 及 將結果Push到Server):

 

1.自動遞增 iOS project 版本

# 遞增Build Version
agvtool next-version -all

 

2.Add git commit with tag and push to server

.

 

# Inject Environment Variables:

${WORKSPACE}/build.properties

 

# 取得目前版本
marketingVersion=$(agvtool what-marketing-version -terse1)
version=$(agvtool what-version -terse)
tagVersion="${marketingVersion}.${version}"

# Git Commit 版本變更
git commit -am "Version ${tagVersion}"

# 寫入版本到檔案 (Post-Build for Inject Environment Variables)
echo tagVersion="${tagVersion}" > "${WORKSPACE}"/build.properties

 


 

參考資料:

https://docs.gitlab.com/ee/integration/jenkins.html#configure-gitlab-users

http://www.cocoachina.com/ios/20160804/17281.html

 

http://ryantang.me/blog/2013/11/28/apple-account-3/

http://www.matrixprojects.net/p/xcodebuild-export-options-plist/

https://itunesconnect.apple.com/docs/UsingApplicationLoader.pdf

http://bcswlmpke.logdown.com/posts/303409-apple-altool-upload-to-testflight

http://blog.nswebfrog.com/2015/10/31/xcodebuild/

http://www.matrixprojects.net/p/xcodebuild-export-options-plist/

http://stackoverflow.com/questions/40790468/error-when-attempting-to-validate-upload-ipa-with-altool?noredirect=1&lq=1

http://blog.ch3cooh.jp/entry/20150220/1424395800

 

Credentials Binding plugin:

https://support.cloudbees.com/hc/en-us/articles/203802500-Injecting-Secrets-into-Jenkins-Build-Jobs

 

Versioning Tool:

https://developer.apple.com/library/content/qa/qa1827/_index.html

 

Inject Environment Variable:

http://stackoverflow.com/questions/31203816/jenkins-inject-environment-variable

arrow
arrow
    全站熱搜

    小賢 發表在 痞客邦 留言(0) 人氣()