ゆーかん

徒然日記

react-native, android, circleCI2.0, fastlaneでdeploy gateへのテスト版自動配信

情報が足りなくてとても辛かったので、情報共有に。

システムの作動順序

  1. githubのstagingにPR
  2. merge
  3. circleCIでbuild用に必要な環境構築
  4. fastlane経由ででdeploygateへのビルド&デプロイコマンド叩く

書くことが増えるのも嫌なので、ここでは3.のcircleCIの設定だけにフォーカスする。

設定ファイル

諸々の説明は公式ドキュメントを参考にした。

version: 2
jobs:
  build:
    docker:
      - image: circleci/android:api-25-alpha

    working_directory: ~/client

    environment:
      JVM_OPTS: -Xmx3200m
      ANDROID_HOME: /opt/android/sdk
    branches:
      only:
        - staging
    steps:
      - checkout
      - run:
          name: install android ndk
          command: |
            wget https://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip
            sudo apt-get install p7zip-full
            7z x android-ndk-r10e-linux-x86_64.zip
            rm android-ndk-r10e-linux-x86_64.zip
            sudo mv android-ndk-r10e /opt/android
            export ANDROID_NDK_HOME=/opt/android/android-ndk-r10e
            export PATH=${PATH}:$ANDROID_NDK_HOME
            curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
            sudo apt-get install -y nodejs
            npm install
            sudo apt-get install ruby2.3 ruby-dev make g++
            sudo gem install fastlane
            cd $HOME/client/android && fastlane android dg
      - store_artifacts:
          path: app/build/reports
          destination: reports

はまりポイントは、次の点くらいかな、、と思います。

  • nodejsをdebian環境にインストールする
  • android ndkのパッケージをどこからダウンロードするか

あれ、だいぶ薄い記事になったな。。