17
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CircleCIからDeployGateへアップロードするときにSHA-1を記録すると捗る

Last updated at Posted at 2015-05-21

背景

  • 開発版の配布にDeployGateを使っている
  • DeployGateのアップロードはGitHubのmasterが更新の都度行っている

問題

この時、試してくれているユーザーがDeployGate上のどのversionを使っているかはすぐわかるのですが、そのversionがどのコミットまで含むものかを調べるのはちょっと面倒です
(立て続けにPRをマージしたときなど特に)

これを解決するためにDeployGateにアップロードする際のメッセージにSHA-1をつけておくと便利です

やり方

まず build.gradle でmessageを環境変数経由で渡せるようにします

build.gradle
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'
        classpath 'com.deploygate:gradle:0.6.2'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

apply plugin: 'deploygate'

deploygate {
  userName = System.getenv('DEPLOYGATE_USER_NAME')
  token    = System.getenv('DEPLOYGATE_API_TOKEN')

  apks {
    debug {
      sourceFile = file("[apk file]")
      message    = System.getenv('CURRENT_HEAD')
    }
  }
}

後は circle.yml内で先程の環境変数にSHA-1をセットすれば完了

circle.yml
deployment:
  staging:
    branch: master
    commands:
      - ./gradlew assembleStagingDebug
      - CURRENT_HEAD=`git rev-parse HEAD` ./gradlew uploadDeployGateDebug

これでアップロードされたバージョン毎のSHA-1が確認できます

17
17
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?