version: 2 jobs: build: working_directory: ~/code docker: - image: circleci/android:api-28 environment: JVM_OPTS: -Xmx3200m MODULE: touch FLAVOR1: Prod FLAVOR2: NoFree BUILD_TYPE: Debug branches: only: - circleCI steps: - checkout - run: name: Setup env command: | echo "export BUILD_TYPE_LOWER=\"$(tr '[:upper:]' '[:lower:]' <<< ${BUILD_TYPE:0:1}${BUILD_TYPE:1})\"" >> $BASH_ENV echo "export FLAVOR1_LOWER=\"$(tr '[:upper:]' '[:lower:]' <<< ${FLAVOR1:0:1}${FLAVOR1:1})\"" >> $BASH_ENV echo "export FLAVOR2_LOWER=\"$(tr '[:upper:]' '[:lower:]' <<< ${FLAVOR2:0:1}${FLAVOR2:1})\"" >> $BASH_ENV - restore_cache: key: jars-{{ checksum "build.gradle" }}-{{ checksum "touch/build.gradle" }}-{{ checksum "common/build.gradle" }} # - run: # name: Chmod permissions #if permission for Gradlew Dependencies fail, use this. # command: sudo chmod +x ./gradlew - run: name: Download Dependencies command: ./gradlew androidDependencies - run: name: Build command: ./gradlew $MODULE:assemble$FLAVOR1_LOWER$FLAVOR2$BUILD_TYPE - save_cache: paths: - ~/.gradle key: jars-{{ checksum "build.gradle" }}-{{ checksum ".touch/build.gradle" }}-{{ checksum "common/build.gradle" }} - run: ls -la ./$MODULE/build/outputs/apk/$FLAVOR1_LOWER$FLAVOR2/$BUILD_TYPE/*.apk - store_artifacts: path: touch/build/outputs/apk/prodNoFree/debug/touch-prod-noFree-debug.apk destination: apk1 - store_artifacts: # path: ./$MODULE/build/outputs/apk/$FLAVOR1_LOWER$FLAVOR2/$BUILD_TYPE/*.apk path: touch/build/outputs/apk/prodNoFree/debug/*.apk destination: apk