ReactNative を使ったアプリケーション作成の際に Bitrise という素敵なCIサービスを使ってビルドする方法をメモしておきます。
証明書を作成する
Android
keytool -genkey -v -keystore example.keystore -alias example -keyalg RSA -keysize 2048 -validity 10000
iOS
Apple Developer に登録
- 課金と使用の開始にリードタイムが3日あるので注意
Apple Developer の設定
- 開発用 Mac の登録
- 開発用 Mac の設定
- App ID の作成
- プロビジョニングの作成
- プロビジョニングの設定
-
.xcodeproj
の設定
1. `path/to/ios/example.xcodeproj`を開く
2. General の Signing の Automatically manage Signing のチェックを外す
3. `example.mobileprovision` を import する
- General の Signing(Debug)
- General の Signing(Release)
4. Build Settings の Signing の Code Signing Identity の項目をすべて Certificates された iOS Developer の設定に変更する
参考:
https://i-app-tec.com/ios/app-release.html
http://dev.classmethod.jp/smartphone/ios-certificates2015/
http://dev.classmethod.jp/references/generate-provisioning-ios7/
http://dev.classmethod.jp/smartphone/iphone/ios-app-how-to-release/
Bitrise を利用する
Bitrise はアプリのビルドを行ってくれるサービスです。
GitHub と連携しており基本的には ReactNative のリポジトリを指定すると自動でビルドしてくれます。
ビルド後には.ipa
と.apk
ができるのでこれを Deploy Gate などで配布します。
基本的にはマニュアルの通りに実行すれば問題なく作成でいますが React Native を利用する際には追加で以下の設定が必要になります。
Android
WorkFlows の設定
- WorkFlows の
Do anything with Script step
のあとに+
でRun npm command
を追加しThe
npm
command with arguments to run
にinstall
と記載 - WorkFlows の
Gradle Runner
のあとに+
でSign APK
を追加 - 右上の
Command + S
で保存
Code Signing の設定
作成したファイルをアップロードする。
それぞれの設定値を設定する。
iOS
WorkFlows の設定
- WorkFlows の
Do anything with Script step
のあとに+
でRun npm command
を追加しThe
npm
command with arguments to run
にinstall
と記載 - 右上の
Command + S
で保存
Code Signing の設定
Export your code signing files with Codesigndoc
のとおりに実行して.mobileprovision
と.p12
を作成する。
作成したファイルをアップロードする。
それぞれの設定値を設定する。