Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
5
Help us understand the problem. What is going on with this article?
@n_komiya

[iOS][fastlane][BITRISE] 構築メモ

More than 1 year has passed since last update.

iOSのビルド環境をfastlaneでBitriseに組んでみたメモ

やりたい事

  • 指定のブランチにpushされたら、ビルドしてfabricのBetaに配布
  • 環境毎に色々変える
  • なるべくfastlaneで

構成

  • XCode (9.3)
  • fastlane (2.105.2)
  • GitLab (self-host)
  • Bitrise

やった事

Bitrise

ほぼfastlane呼ぶだけ。Code SigningやSecrets、Env Varsなし

bitrise.yml
---
format_version: '5'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: ios
workflows:
  beta:
    steps:
    - activate-ssh-key:
        run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
        inputs:
        - verbose: 'true'
    - git-clone:
        inputs:
        - update_submodules: 'no'
    - cache-pull: {}
    - fastlane:
        inputs:
        - lane: beta
    - cache-push:
        inputs:
        - cache_paths: "$BITRISE_CACHE_DIR"
trigger_map:
- push_branch: beta/*
  workflow: beta

fastlane

  • import_from_gitでPrivate RepositoryのFastfileからENVに読み込む
fastlane/Fastfile
default_platform(:ios)

import_from_git(
  url: "ssh://git@hoge/secret.git", branch: "master"
)

platform :ios do

  lane :beta do |options|
    if is_ci?
      ENV["FASTLANE_PASSWORD"]=ENV["APPLE_ID_PASSWORD"]
    end

    match

    update_build_number
    add_badge(dark: true)

    build(
      app_identifier: ENV["APP_IDENTIFIER_BETA"],
      provisioning_profile: ENV["PROVISIONING_PROFILE_BETA"],
      development_team: ENV["TEAM_ID"]
    )

    if is_ci?
      add_git_tag
      push_git_tags
    end

    crashlytics
    upload_symbols_to_crashlytics

  end
end
  • increment_build_numberが使いにくかったのでupdate_build_numberを作った
  private_lane :update_build_number do
    app_version = get_info_plist_value(path:'./Info.plist', key: 'CFBundleShortVersionString')
    next_build_number = "#{app_version}.#{number_of_commits}"
    set_info_plist_value(path: './Info.plist', key: 'CFBundleVersion', value: next_build_number)
    lane_context[SharedValues::BUILD_NUMBER] = next_build_number
  end
  • Xcode9とmatchでgymがうまくいかなった分の対応
    • Exit status: 65とかExit status: 70とか

Fastlane gym does not use provisioning profile set by match

  private_lane :build do |options|
    settings_to_override = {
      :BUNDLE_IDENTIFIER => options[:app_identifier],
      :PROVISIONING_PROFILE_SPECIFIER => options[:provisioning_profile],
      :DEVELOPMENT_TEAM => options[:development_team]
    }
    gym(xcargs: settings_to_override)
  end

設定はそれぞれに

fastlane/Appfile
apple_id ENV["APPLE_ID"]
team_id ENV["TEAM_ID"]
fastlane/Matchfile
git_url "ssh://git@hoge/certificates.git"
for_lane :beta do
    force_for_new_devices true
    type "adhoc"
end
fastlane/Gymfile
for_lane :beta do
    scheme "Beta"
    export_method "ad-hoc"
end

やりたい事

  • deliverでrelease
  • slackからbeta, release
  • danger
5
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
yumemi
みんなが知ってるあのサービス、実はゆめみが作ってます。スマホアプリ/Webサービスの企画・UX/UI設計、開発運用。Swift, Kotlin, PHP, Vue.js, React.js, Node.js, AWS等エンジニア・クリエイターの会社です。Twitterで情報配信中https://twitter.com/yumemiinc

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
5
Help us understand the problem. What is going on with this article?