• 模版组件上传

    通过第一步,第二步组件的开发和配置就已完成,我们仅需将模版上传至打包平台即可。我们采用将代码上传至git仓库(github,gitlab或自建平台均可),并上传到hippius平台的repo中

    上传到git仓库

    1、 需上传文件的目录结构为模版组件如图4.1

    图4.1

    2、 上传至git仓库,生成SSH KEY并上传github的方法如下 如果上传组件到猪翅鱼,可忽略此步骤,因为在组件开发的时候已经配置

    $ git config --global user.name "用户名"
    $ git config --global user.email "邮箱"
    
    $ ssh-keygen -t rsa -C “邮箱”
    按3个回车,密码为空。
    

    #将ssh key添加到SSH agent中 ssh-add ~/.ssh/id_rsa

    然后根据提示连续回车即可在~/.ssh目录下得到id_rsa和id_rsa.pub两个文件,id_rsa.pub文件里存放的就是我们要配置在github的公钥,id_rsa是需要配置到Hippius打包平台的私钥。

    (1)登录github

    (2)点击右上方的Accounting settings图标

    (3)选择 SSH key

    (4)点击 Add SSH key

    ssh -T
    git@github.com
    

    模板上传repo步骤

    1. 创建私有repo

    pod repo add hippiusBase git@code.choerodon.com.cn:mobile-center-hippius/hippius-ios-repo.git
    

    2. 修改podspec

    demo的就是

    #
    # Be sure to run `pod lib lint EipApplication.podspec' to ensure this is a
    # valid spec before submitting.
    #
    # Any lines starting with a # are optional, but their use is encouraged
    # To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
    #
    
    Pod::Spec.new do |s|
      s.name             = 'HippiusDemo'
      s.version          = '1.0.1'
      s.summary          = '测试模板'
    
    # This description is used to generate tags and improve search results.
    #   * Think: What does it do? Why did you write it? What is the focus?
    #   * Try to keep it short, snappy and to the point.
    #   * Write the description between the DESC delimiters below.
    #   * Finally, don't worry about the indent, CocoaPods strips it!
    
      s.description      = <<-DESC
    TODO: Add long description of the pod here.
                           DESC
    
      s.homepage         = 'https://github.com/jinliyuelong/HippiusDemo'
      # s.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
      s.license          = { :type => 'MIT', :file => 'LICENSE' }
      s.author           = { 'liyanjun' => '1254463047@qq.com' }
      s.source           = { :git => 'https://github.com/jinliyuelong/HippiusDemo.git', :tag => s.version.to_s }
      # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
    
      s.ios.deployment_target = '8.0'
    
      s.source_files = 'Classes/**/*'
      s.resources    = "Resources/HippiusDemo.bundle"
    
      s.dependency 'HippiusCommonBusiness'
      s.dependency 'HippiusBaseComponent'
    
    end
    
    

    3. 验证

    脚本地址

    进入到下载好的压缩文件解压后的路径执行脚本

    ./validate.sh -p "HippiusDemo"  -s "/Users/liyanjun/work/02ios/01海马汇改造/01code/hippius模板库/demo/HippiusDemo"
    
    

    -p 参数传递code代码 -s 传递代码路径

    4. 上传git

    git add .
    git commit -m "1.0.1"
    git push 
    git tag -m "1.0.1" 1.0.1
    git push --tags
    

    注意tag的版本要和podspec编写的一致

    在Hippius打包平台配置模版组件需要填写的主要信息如图3.2,其中“页面代码”为“template_config.json”中的”pageCode”,gitKey请填写上一步配置的SSH KEY的私钥。

    图4.2