10
7

More than 3 years have passed since last update.

GitHub ActionsでAndroidビルドとユニットテストとDeployGateに公開する

Last updated at Posted at 2019-12-04

1.以下のDeployGateのAPIキーとユーザはGitHubのリポジトリページにあるSettings→Secretsから追加してください

DEPLOYGATE_API_KEY ・・・DeployGateのプロフィールページに記載されてます
DEPLOYGATE_USER ・・・DeployGateのユーザ名

1.[Settings]をクリック

スクリーンショット 2019-12-05 10.12.46.png

2.[Secrets]をクリック

スクリーンショット 2019-12-05 10.16.38.png

3.以下の要領で[DEPLOYGATE_API_KEY]と[DEPLOYGATE_USER]を追加

スクリーンショット 2019-12-05 10.17.53.png

4.最終的にこのような感じ

スクリーンショット 2019-12-05 10.18.31.png

2.GitHubのリポジトリページにあるActionsからymlファイルを追加します。

1.[Actions]をクリック

スクリーンショット 2019-12-05 10.25.01.png

2.[Set up a workflow yourself]をクリック

スクリーンショット 2019-12-05 10.25.55.png

3.プロジェクトルートに/.github/workflows/main.ymlがができるので以下の内容をコピペ

ymlファイルのファイル名はなんでも良い

main.yml
name: Android CI

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
    - name: set up JDK 1.8
      uses: actions/setup-java@v1
      with:
        java-version: 1.8
    # The following generates a debug APK
    - name: Build with Gradle
      run: ./gradlew assembleDebug
    # The following is running unit tests
    - name: Unit Test
      run: ./gradlew test
    # The following is uploading debug apk to the deploygate
    - name: Distribute App
      run: |
       curl \
        -H "Authorization: token ${{secrets.DEPLOYGATE_API_KEY}}" \
        -F "file=@app/build/outputs/apk/debug/app-debug.apk" \
        -F "message=Any message" \
        "https://deploygate.com/api/users/${{secrets.DEPLOYGATE_USER}}/apps"

4.[Start commit]ボタンをクリックしてymlファイルをリポジトリに登録します
5.あとはリポジトリにプッシュするたびに、ビルド、ユニットテスト、DeployGateへdebugAPKアップロードまで行います。
10
7
0

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
10
7