Fastlane match管理證書(shū), sigh重簽ipa

使用fastlane match管理證書(shū), 主電腦更新證書(shū)和描述文件, 其他電腦同步證書(shū)和描述文件
.env文件配置

# bundle id
app_identifier      = "xxx"

# 創(chuàng)建應(yīng)用的時(shí)候用到
# 應(yīng)用名稱
app_name            = "xxx"
# 應(yīng)用版本號(hào)
app_version         = "xxx"
# 應(yīng)用語(yǔ)言
app_language        = "xxx"

# 開(kāi)發(fā)者賬號(hào)
apple_id            = "xxx"
# team_id 開(kāi)發(fā)者中心membership中可以查到
team_id             = "xxx"
# team_name 開(kāi)發(fā)者中心membership中可以查到
team_name           = "xxx"

# match管理的證書(shū)的git倉(cāng)庫(kù)地址
cer_git_url         = "xxx"
# match管理的證書(shū)的git倉(cāng)庫(kù)分支, 如master
cer_git_branch      = "xxx"

# 開(kāi)發(fā)者賬號(hào)
username           = ENV["apple_id"]
# team_id 開(kāi)發(fā)者中心membership中可以查到
team_id            = ENV["team_id"]
# team_name 開(kāi)發(fā)者中心membership中可以查到
team_name          = ENV["team_name"]
# match管理的證書(shū)的git倉(cāng)庫(kù)地址
git_url            = ENV["cer_git_url"]
# match管理的證書(shū)的git倉(cāng)庫(kù)分支
cer_git_branch     = ENV["cer_git_branch"]
# 多個(gè)bundle id, 管理一個(gè)賬號(hào)下多個(gè)應(yīng)用的證書(shū),描述文件
app_identifiers    = ["xxx1", "xxx2", "xxx3"]
# 默認(rèn)ipa名字, 主要用于重簽
default_ipa_name   = "xxx.ipa"
  desc "更新證書(shū)描述文件"
  lane :createCerAndProvisionFile do
    register_devices(
      # 需要添加的設(shè)備
      devices: {
        "設(shè)備名稱1" => "xxx"
      }
    ) # Simply provide a list of devices as a Hash

    app_identifiers.each { |bundle_id|
      match(git_url: git_url,        
            type: "development",
            git_branch: cer_git_branch,
            shallow_clone: true,
            clone_branch_directly: true,
            generate_apple_certs: true,
            username: username,
            team_id: team_id,
            team_name: team_name,
            app_identifier: bundle_id,
            force_for_new_devices: true)
      match(git_url: git_url,
            type: "adhoc",
            git_branch: cer_git_branch,
            generate_apple_certs: true,
            shallow_clone: true,
            clone_branch_directly: true,
            username: username,
            team_id: team_id,
            team_name: team_name,
            app_identifier: bundle_id,
            force_for_new_devices: true)
      match(git_url: git_url,
            type: "appstore",
            git_branch: cer_git_branch,
            generate_apple_certs: true,
            shallow_clone: true,
            clone_branch_directly: true,
            username: username,
            team_id: team_id,
            team_name: team_name,
            app_identifier: bundle_id)
    }
  end

  desc "同步證書(shū)和描述文件,只讀權(quán)限, 不會(huì)動(dòng)開(kāi)發(fā)者中心中的證書(shū)和描述文件"
  lane :syncCodeSigning do
    app_identifiers.each { |bundle_id|
          match(git_url: git_url,
          type: "development",
          git_branch: cer_git_branch,
          username: username,
          team_id: team_id,
          team_name: team_name,
          app_identifier: bundle_id,
          readonly: true,
          force_for_new_devices: true)
    match(git_url: git_url,
          type: "adhoc",
          git_branch: cer_git_branch,
          username: username,
          team_id: team_id,
          team_name: team_name,
          app_identifier: bundle_id,
          readonly: true,
          force_for_new_devices: true)
    match(git_url: git_url,
          type: "appstore",
          git_branch: cer_git_branch,
          username: username,
          team_id: team_id,
          team_name: team_name,
          app_identifier: bundle_id,
          readonly: true)
    }
  end

使用fastlane sigh 重簽ipa包

  # ipa重簽
  lane :resignAdhocIpa do |lane|
    # 先添加設(shè)備
    createCerAndProvisionFile
    # 使用match從倉(cāng)庫(kù)地址拉取最新的證書(shū)
    config = FastlaneCore::Configuration.create(Match::Options.available_options, {}).load_configuration_file('Matchfile').options
    config[:clone_branch_directly] = true
    config[:skip_docs] = true
    config[:shallow_clone] = true
    config[:git_branch] = 'master'

    # clone repo to get path    
    storage = Match::Storage.for_mode('git', config)
    storage.download

    encryption = Match::Encryption.for_storage_mode('git', {
      git_url: config[:git_url],
      working_directory: storage.working_directory
    })
    encryption.decrypt_files if encryption
    UI.success("Repo is at: '#{storage.working_directory}'")


    fastlane_directory = Dir.pwd
    app_patch = "#{fastlane_directory}/../ipa/AdHoc/#{default_ipa_name}"
    # 證書(shū)描述文件備份
    FileUtils.cp_r("#{storage.working_directory}/profiles", "#{fastlane_directory}/證書(shū)相關(guān)/")
    FileUtils.cp_r("#{storage.working_directory}/certs", "#{fastlane_directory}/證書(shū)相關(guān)/")
    # 開(kāi)始重簽
    resign(
      ipa: app_patch, # can omit if using the `ipa` action
      #   證書(shū)的名稱或者證書(shū)的SHA-1
      signing_identity: "xxx",
      provisioning_profile: "#{storage.working_directory}/profiles/adhoc/AdHoc_xxx.mobileprovision", # can omit if using the _sigh_ action
    )

  end

signing_identity如何取值, 在終端執(zhí)行, 兩個(gè)值取其一

fastlane sigh resign xxx.ipa
image.png
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末逾一,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌,老刑警劉巖度陆,帶你破解...
    沈念sama閱讀 216,997評(píng)論 6 502
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場(chǎng)離奇詭異狭瞎,居然都是意外死亡党窜,警方通過(guò)查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,603評(píng)論 3 392
  • 文/潘曉璐 我一進(jìn)店門(mén)点把,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)橘荠,“玉大人,你說(shuō)我怎么就攤上這事郎逃「缤” “怎么了?”我有些...
    開(kāi)封第一講書(shū)人閱讀 163,359評(píng)論 0 353
  • 文/不壞的土叔 我叫張陵褒翰,是天一觀的道長(zhǎng)贮懈。 經(jīng)常有香客問(wèn)我,道長(zhǎng)优训,這世上最難降的妖魔是什么朵你? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 58,309評(píng)論 1 292
  • 正文 為了忘掉前任,我火速辦了婚禮揣非,結(jié)果婚禮上抡医,老公的妹妹穿的比我還像新娘。我一直安慰自己早敬,他們只是感情好忌傻,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,346評(píng)論 6 390
  • 文/花漫 我一把揭開(kāi)白布。 她就那樣靜靜地躺著搞监,像睡著了一般水孩。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上琐驴,一...
    開(kāi)封第一講書(shū)人閱讀 51,258評(píng)論 1 300
  • 那天俘种,我揣著相機(jī)與錄音,去河邊找鬼棍矛。 笑死安疗,一個(gè)胖子當(dāng)著我的面吹牛抛杨,可吹牛的內(nèi)容都是我干的够委。 我是一名探鬼主播,決...
    沈念sama閱讀 40,122評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼怖现,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼茁帽!你這毒婦竟也來(lái)了玉罐?” 一聲冷哼從身側(cè)響起,我...
    開(kāi)封第一講書(shū)人閱讀 38,970評(píng)論 0 275
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤潘拨,失蹤者是張志新(化名)和其女友劉穎吊输,沒(méi)想到半個(gè)月后,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體铁追,經(jīng)...
    沈念sama閱讀 45,403評(píng)論 1 313
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡季蚂,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,596評(píng)論 3 334
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了琅束。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片扭屁。...
    茶點(diǎn)故事閱讀 39,769評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖涩禀,靈堂內(nèi)的尸體忽然破棺而出料滥,到底是詐尸還是另有隱情,我是刑警寧澤艾船,帶...
    沈念sama閱讀 35,464評(píng)論 5 344
  • 正文 年R本政府宣布葵腹,位于F島的核電站,受9級(jí)特大地震影響屿岂,放射性物質(zhì)發(fā)生泄漏践宴。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,075評(píng)論 3 327
  • 文/蒙蒙 一雁社、第九天 我趴在偏房一處隱蔽的房頂上張望浴井。 院中可真熱鬧,春花似錦霉撵、人聲如沸磺浙。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 31,705評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)撕氧。三九已至,卻和暖如春喇完,著一層夾襖步出監(jiān)牢的瞬間伦泥,已是汗流浹背。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 32,848評(píng)論 1 269
  • 我被黑心中介騙來(lái)泰國(guó)打工锦溪, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留不脯,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 47,831評(píng)論 2 370
  • 正文 我出身青樓刻诊,卻偏偏與公主長(zhǎng)得像防楷,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子则涯,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,678評(píng)論 2 354