0%

shell 配合 fastlane 打包多个 target

前言

试一下 fastlane 进行打包上传到 testflight。

步骤

  1. 安装 fastlane

  2. 安装插件 fastlane-plugin-versioning

  3. 编辑 Fastfile

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    desc "Push a new beta build to TestFlight"
    lane :beta do |options|
    #项目名
    target = options[:t]
    build_number = options[:n]
    puts("要打包 #{target} 版本号 #{build_number}")
    increment_build_number_in_plist(target: "#{target}", build_number: "#{build_number}")
    #increment_build_number_in_plist(target: "Today", build_number: "#{build_number}")
    build_app(workspace: "XXXX.xcworkspace" ,scheme: "#{target}")
    upload_to_testflight
    end
  4. 新建 tf.shell

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    #!/bin/sh
    echo "选择要进行 tf 的项目"

    select target in "target1" "target2" "target3"
    do
    case $target in
    "target1") targetName="target1"; break ;;
    "target2") targetName="target2"; break ;;
    "target3") targetName="target3"; break ;;
    *) echo "选的不对,再选一次" ;;
    esac
    done

    echo "已经选择" $targetName

    currentTime=`date '+%Y%m%d%H%M'`
    echo "现在时间 $currentTime"

    # fastlane
    fastlane beta t:$targetName n:$currentTime