Skip to content

Instantly share code, notes, and snippets.

@nekonenene
Last active May 23, 2019 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nekonenene/104467eeffdc8c8be74f3546d2133fb1 to your computer and use it in GitHub Desktop.
Save nekonenene/104467eeffdc8c8be74f3546d2133fb1 to your computer and use it in GitHub Desktop.
Android アプリを deploygate にデプロイする CircleCI 2.0 設定(ブログ公開用) https://nekonenene.hatenablog.com/entry/circleci_2-deploygate-android
aliases:
android_docker: &android_docker
docker:
- image: circleci/android:api-28
environment:
TZ: Asia/Tokyo
steps:
- restore_cache: &restore_cache
key: &jars_key jars-{{ checksum "build.gradle.kts" }}-{{ checksum "app/build.gradle.kts" }}
- run: &download_deps
name: Download dependencies
command: ./gradlew androidDependencies
- save_cache: &save_cache
paths:
- ~/.gradle
key: *jars_key
- run: &build_debug_apk
name: Build debug APK
command: ./gradlew assembleDebug
- run: &test
name: test
command: ./gradlew test
- run: &upload_to_deploy_gate
name: Upload to DeployGate # Set DG_API_KEY in CircleCI
command: |
APK_PATH=app/build/outputs/apk/debug/app-debug.apk
TIME=$(date "+%Y/%m/%d %H:%M")
COMMIT_HASH=$(git log --format="%H" -n 1 | cut -c 1-8)
USERNAME=nekonenene
curl -F "file=@${APK_PATH}" -F "token=${DG_API_KEY}" -F "message=Build by CircleCI <${COMMIT_HASH}> (${TIME})" https://deploygate.com/api/users/${USERNAME}/apps
version: 2
jobs:
build:
<<: *android_docker
steps:
- checkout
- restore_cache: *restore_cache
- run: *download_deps
- save_cache: *save_cache
- run: *build_debug_apk
test:
<<: *android_docker
steps:
- checkout
- restore_cache: *restore_cache
- run: *download_deps
- save_cache: *save_cache
- run: *test
deploy:
<<: *android_docker
steps:
- checkout
- restore_cache: *restore_cache
- run: *download_deps
- save_cache: *save_cache
- run: *build_debug_apk
- run: *upload_to_deploy_gate
workflows:
version: 2
build_and_deploy:
jobs:
- build
- test
- deploy:
requires:
- build
- test
filters:
branches:
only: master
context: deploygate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment