美文网首页
借助jenkins自动打包IPA

借助jenkins自动打包IPA

作者: piao152 | 来源:发表于2017-10-25 18:54 被阅读9次

    Jenkins安装

    借助homebrew,直接调用 brew install jenkins

    打包脚本

    本质上还是shell脚本,只不过借助ant解析,只不过,jenkins配置路径,全都是相对路径,默认路径是.jenkins/workspace,在jenkins首页可以设置默认路径

    <?xml version="1.0" encoding="UTF-8"?>
    <project name="autoBuildProject" default="exportIpa" basedir="../../ProJ_WorkSpace/MemberShip_Dev">
    
      <!-- 打包程序路径 -->
      <property name="build_project_path" value="~/ProJ_Git/AutoBuildProject"/>
      <!-- 打包操作路径 -->
      <property name="workspace_path" value="${basedir}/.."/>
      <!-- 项目路径 -->
      <property name="project_path" value="${workspace_path}/MemberShip_Dev"/>
      <!-- 替换程序路径 -->
      <property name="replace_path" value="${workspace_path}/Edit_Replace"/>
      <!-- 项目名称 -->
      <property name="project_name" value="PortraitCollect"/>
      <!-- workspace名称 -->
      <property name="workspace_name" value="PortraitCollect.xcworkspace"/>
      <!-- scheme名称 -->
      <property name="scheme_name" value="PortraitCollect"/>
      <!-- configuration选项 -->
      <property name="configuration" value="Release"/>
      <!-- archive包路径 -->
      <property name="archive_path" value="${workspace_path}/MemberShip"/>
      <!-- ipa文件输出路径 -->
      <property name="out_ipa_path" value="~/Desktop/outIpa"/>
      <!-- 打包需要plist文件路径 -->
      <property name="plist_path" value="${build_project_path}/ExportOptions.plist"/>
    
      <target name="copyFile">
        <copy todir="${project_path}">
          <fileset dir="${replace_path}/">
          </fileset>
        </copy>
      </target>
    
      <target name="build" depends="copyFile">
        <exec executable="xcodebuild" failonerror="true">
          <arg value="-workspace"/>
          <arg value="${workspace_name}"/>
          <arg value="-scheme"/>
          <arg value="${scheme_name}"/>
        </exec>
      </target>
    
      <target name="archive" depends="build">
        <exec executable="xcodebuild" failonerror="true">
          <arg value="archive"/>
          <arg value="-workspace"/>
          <arg value="${workspace_name}"/>
          <arg value="-configuration"/>
          <arg value="${configuration}"/>
          <arg value="-scheme"/>
          <arg value="${scheme_name}"/>
          <arg value="-archivePath"/>
          <arg value="${archive_path}"/>
        </exec>
      </target>
    
      <target name="exportIpa" depends="archive">
        <exec executable="xcodebuild" failonerror="true">
          <arg value="-exportArchive"/>
          <arg value="-archivePath"/>
          <arg value="${archive_path}.xcarchive"/>
          <arg value="-exportOptionsPlist"/>
          <arg value="${plist_path}"/>
          <arg value="-exportPath"/>
          <arg value="${out_ipa_path}"/>
        </exec>
        <exec executable="hostname" outputproperty="hostname.domain" > 
                           <arg value="-f"/> 
                       </exec> 
      </target>
    </project>
    

    相关文章

      网友评论

          本文标题:借助jenkins自动打包IPA

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