指定project的fastlane

2023-06-15  本文已影响0人  太平洋_cfd2

ps:
http://docs.fastlane.tools/actions/gym/#gym

lane :push do
        # add actions here: https://docs.fastlane.tools/actions

    app_url = "https://www.pgyer.com/s2iU"
    
    #lastArchiveDate = sh("cat build/lastArchiveDate.log")
    #sh("echo 'lastArchiveDate: #{lastArchiveDate}'")

    # 当前时间
    #currentDate = `date +%Y-%m-%d_%T`
    #sh("echo 'currentDate: #{currentDate}'")

    #更新日志
    #updateLog = sh("git log --after='#{lastArchiveDate}' --before='#{currentDate}' --pretty=format:'1. ## <font color=DeepPink>%s</font>' HEAD")
    #sh("echo 'updateLog: \n#{updateLog}'")
    
    updateLog = "1. <font color=DeepPink>优化bug</font>"
    sh("echo 'updateLog: \n#{updateLog}'")

    updateText = " # iOS用户端 \n #{updateLog} \n\n \n\n [@13430797822](#{app_url})\n [@15875515950](#{app_url})\n [@17580959503](#{app_url})\n [@15112588418](#{app_url})\n ![downloadQrcode](https://www.pgyer.com/app/qrcode/s2iU) \n\n"

    #自动签名
    #update_code_signing_settings(
    #  path: "Application/Move.xcodeproj",
    #  use_automatic_signing: true
    #)

    gym(
          clean: true,
          silent: true,
      project: "Application/Move.xcodeproj",
          export_method: 'ad-hoc',
          output_directory: './fastlane/build',
          output_name:"customer.ipa",
          scheme: 'Customer',
          configuration: 'Release',
          ###########
          # sdk:"iOS 12.0",
          # archive_path:"./fastlane/Archive",
          include_symbols:true,
          export_xcargs: "-allowProvisioningUpdates",
    )

    pgyer(
        api_key: "99515a312c2607fc764855dcca5760b1",
    )
 
    # 钉钉机器人
    app_patch = "build/customer.ipa"
    app_version = "1.0.0"
    app_build_version = "1"
    app_name    = "博帅王子"

    dingTalk_url = "https://oapi.dingtalk.com/robot/send?access_token=c9f1a24d7d82be81dcbe2a457e4f2e6a3ccc47fa5a3cecbda249a1dbc82d2e5a"

    # 构造消息格式
    actionCard =
    {
    "markdown": {
        "title": "iOS 内测版",
        "text": updateText,
    },
    "at": {
        "atMobiles": [
            "13430797822",
            "15875515950",
            "17580959503",

            "15112588418",
        ],
        "isAtAll": false
    },
    "msgtype": "markdown"
    }

    puts "发送的钉钉消息:#{actionCard} "

    uri = URI.parse(dingTalk_url)
    https = Net::HTTP.new(uri.host, uri.port)
    https.use_ssl = true

    request = Net::HTTP::Post.new(uri.request_uri)
    request.add_field('Content-Type', 'application/json')
    request.body = actionCard.to_json

    response = https.request(request)
    
    sh("echo `date +%Y-%m-%d_%T` > build/lastArchiveDate.log")

  end
上一篇下一篇

猜你喜欢

热点阅读