IOS模塊化 開發實踐

直接入正題:

Screen Shot 2015-09-18 at 16.56.20.png

Mac上安裝Jekins

jekins下載地址:http://jenkins-ci.org/ ,選擇Mac 直接安裝。安裝成功后。訪問http://localhost 是否可正常訪問.

安裝Jekins相關插件

證書管理插件
1.https://wiki.jenkins-ci.org/display/JENKINS/Keychains+and+Provisioning+Profiles+Plugin#KeychainsandProvisioningProfilesPlugin-Uploadkeychainandprovisioningprofilefilessection

xcode插件
2.https://wiki.jenkins-ci.org/display/JENKINS/XCode+Plugin#XcodePlugin-Installationguide

腳本執行插件
3.https://wiki.jenkins-ci.org/display/JENKINS/PostBuildScript+Plugin

git插件
4.https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin

IOS證書管理和修正

1.點擊 Manage Jenkins-> [Keychains and Provisioning Profiles Management] 進入如下頁面

Screen Shot 2015-09-18 at 15.49.30.png

2.點擊choose File 并上傳 當前登錄用戶的~/Library/Keychain/login.keychain文件.
上傳成功后會出現:

Screen Shot 2015-09-18 at 15.55.05.png

點擊Add Code Signing Identity添加對應的簽名

3.上傳Provisioning Profiles文件,xcode的profile存放在~/Library/MobileDevice/Provisioning Profiles/中,找到你要的profile,上傳

Screen Shot 2015-09-18 at 16.04.46.png
這步很重要,如果證書出錯請查看:http://www.cnblogs.com/qingjoin/p/3929493.html

新建項目

1.New Item -> 選擇FreeStyle project
2.關聯GIt

Screen Shot 2015-09-18 at 16.27.12.png

3.Xcode的相關配置

Screen Shot 2015-09-18 at 16.29.41.png
Screen Shot 2015-09-18 at 16.29.55.png
Screen Shot 2015-09-18 at 16.30.02.png

4.ipa上傳到蒲公英和發送郵件

Screen Shot 2015-09-18 at 16.30.40.png

5.相關的python文件的地址為:
https://github.com/caiwenshu/CI_pgy/blob/master/pgy_upload_temp.py

該代碼引用來自:http://www.cocoachina.com/ios/20150428/11698.html

最新補充 (2020/02/19)

因為jenkins里面xcode配置麻煩,現在已經把ios的打包移植到fastlane里面了。


source ~/.bash_profile
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

echo $WORKSPACE
export output_dir=/Users/Shared/Jenkins/${BUILD_TAG}
export output_ipa_name=${BUILD_TAG}.ipa

echo $output_dir
echo $output_ipa_name

rm -rf release

ruby -v

bundle install


pwd

security unlock-keychain -p shenmajr /Users/macpro/Library/Keychains/login.keychain-db

fastlane release output_dir:$output_dir output_ipa_name:$output_ipa_name

對應的fastlane代碼

# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
#     https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
#     https://docs.fastlane.tools/plugins/available-plugins
#

# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane

default_platform(:ios)

platform :ios do 
  desc "Description of what the lane does"
  lane :release do |options|
    cocoapods
    gym(scheme: "ShenmaEV_iOS_SaaS",
    workspace:"ShenmaEV_iOS_SaaS.xcworkspace",
    configuration:"Release",
    clean: true,
    export_method:"enterprise",
    output_directory:options[:output_dir],
    buildlog_path:options[:output_dir],
    output_name:options[:output_ipa_name])
    # add actions here: https://docs.fastlane.tools/actions

  end


  lane :debug do |options|
    cocoapods
    gym(scheme: "ShenmaEV_iOS_SaaS",
    workspace:"ShenmaEV_iOS_SaaS.xcworkspace",
    configuration:"Debug",
    clean: true,
    export_method:"development",
    output_directory:options[:output_dir],
    buildlog_path:options[:output_dir],
    output_name:options[:output_ipa_name])
    # add actions here: https://docs.fastlane.tools/actions
  end
end

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。