Skip to content

Commit

Permalink
Merge pull request #680 from DroidKaigi/generate_materials_even_on_ta…
Browse files Browse the repository at this point in the history
…g_push

Fixed the build failure on tag-push
  • Loading branch information
jmatsu committed Sep 27, 2018
2 parents 5907d37 + 1ae6cb9 commit f5dfc76
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
12 changes: 12 additions & 0 deletions .circleci/bash.source
@@ -0,0 +1,12 @@
is_on_master_or_release() {
[[ "${CIRCLE_BRANCH:-undefined}" =~ ^(master|release)$ ]]
}
should_be_release() {
deploy_to_google_play || is_on_master_or_release
}
deploy_to_deploygate() {
is_on_master_or_release
}
deploy_to_google_play() {
[[ "${CIRCLE_TAG:-undefined}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]
}
15 changes: 8 additions & 7 deletions .circleci/config.yml
Expand Up @@ -9,6 +9,7 @@ jobs:
GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-Xmx1536m -XX:+HeapDumpOnOutOfMemoryError"'
steps:
- checkout
- run: echo "source $(git rev-parse --show-toplevel)/.circleci/bash.source" >> $BASH_ENV
- restore_cache:
key: jars-{{ checksum "build.gradle.kts" }}-{{ checksum "app/build.gradle.kts" }}
- restore_cache:
Expand All @@ -30,45 +31,45 @@ jobs:
- run:
name: decrypt keystore
command: |
if [[ "${CIRCLE_BRANCH:-undefined}" =~ ^(master|release)$ ]]; then
if should_be_release; then
openssl aes-256-cbc -k $KEYSTORE_DECRYPT_PASSWORD -d -in encrypted-droidkaigi-key -out release.keystore -md sha256
fi
- run:
name: decrypt json
command: |
if [[ "${CIRCLE_BRANCH:-undefined}" =~ ^(master|release)$ ]]; then
if should_be_release; then
openssl aes-256-cbc -k $JSON_DECRYPT_PASSWORD -d -in encrypted-google-services.json -out app/google-services.json -md sha256
fi
- run:
name: Test
command: |
if [[ "${CIRCLE_BRANCH:-undefined}" =~ ^(master|release)$ ]]; then
if should_be_release; then
./gradlew --stacktrace testRelease
else
./gradlew --stacktrace test${APP_BUILD_TYPE^}
fi
- run:
name: Build
command: |
if [[ "${CIRCLE_BRANCH:-undefined}" =~ ^(master|release)$ ]]; then
if should_be_release; then
./gradlew --offline --stacktrace assembleRelease
else
./gradlew --offline --stacktrace assemble${APP_BUILD_TYPE^}
fi
- run:
name: Check
command: |
if [[ ! "${CIRCLE_BRANCH:-undefined}" =~ ^(master|release)$ ]]; then
if ! is_on_master_or_release; then
./gradlew --stacktrace lint${APP_BUILD_TYPE^}
./gradlew --stacktrace ktlint${APP_BUILD_TYPE^}Check
bundle exec danger
fi
- run:
name: Deploy
command: |
if [[ "${CIRCLE_BRANCH:-undefined}" == 'master' ]]; then
if deploy_to_deploygate; then
./gradlew :app:uploadDeployGateRelease
elif [[ "${CIRCLE_TAG:-undefined}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
elif deploy_to_google_play; then
echo "Deploy to Google Play"
openssl aes-256-cbc -k $PUBLISHER_KEYS_JSON_DECRYPT_PASSWORD -d -in encrypted-publisher-keys.json -out app/publisher-keys.json -md md5
./gradlew publishApkRelease
Expand Down

0 comments on commit f5dfc76

Please sign in to comment.