Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the build failure on tag-push #680

Merged
merged 1 commit into from
Sep 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .circleci/bash.source
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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