-
-
Save trung85/5fce5da5a81694fa77d93722c5827336 to your computer and use it in GitHub Desktop.
Circle CI + Slack Config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2 | |
jobs: | |
check-build: | |
docker: | |
# specify the version you desire here | |
- image: circleci/android:api-27-alpha | |
working_directory: ~/code | |
steps: | |
- checkout | |
- run: echo "Running..." | |
- restore_cache: | |
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }} | |
- run: | |
name: Download Dependencies | |
command: ./gradlew androidDependencies | |
- save_cache: | |
paths: | |
- ~/.gradle | |
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }} | |
- run: | |
name: Initial build | |
command: ./gradlew clean assembleDebug --no-daemon --stacktrace | |
- store_artifacts: | |
path: app/build/outputs/apk/ | |
destination: apks/ | |
dev-build: | |
docker: | |
# specify the version you desire here | |
- image: circleci/android:api-27-alpha | |
working_directory: ~/code | |
steps: | |
- checkout | |
- run: echo "Running..." | |
- restore_cache: | |
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }} | |
- run: | |
name: Download Dependencies | |
command: ./gradlew androidDependencies | |
- save_cache: | |
paths: | |
- ~/.gradle | |
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }} | |
- run: | |
name: Initial build | |
command: ./gradlew clean assembleDebug --no-daemon --stacktrace | |
- store_artifacts: | |
path: app/build/outputs/apk/ | |
destination: apks/ | |
- run: | |
name: Upload to Slack | |
command: | | |
export GIT_COMMIT_DESC=$(git log --format=oneline -n 1 | sed -E 's/^[^ ]+ (.*)$/\1/g') | |
curl -F file=@app/build/outputs/apk/debug/app-debug.apk -F channels=$SLACK_CHANNEL -F token=$SLACK_API_TOKEN -F title="${CIRCLE_PROJECT_REPONAME} | branch -> ${CIRCLE_BRANCH} | commit -> ${GIT_COMMIT_DESC}" https://slack.com/api/files.upload | |
prod-build: | |
docker: | |
# specify the version you desire here | |
- image: circleci/android:api-27-alpha | |
working_directory: ~/code | |
steps: | |
- checkout | |
- run: echo "Running..." | |
- restore_cache: | |
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }} | |
- run: | |
name: Download Dependencies | |
command: ./gradlew androidDependencies | |
- save_cache: | |
paths: | |
- ~/.gradle | |
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }} | |
- run: | |
name: Initial build | |
command: ./gradlew clean assembleRelease --no-daemon --stacktrace | |
- store_artifacts: | |
path: app/build/outputs/apk/ | |
destination: apks/ | |
- run: | |
name: Upload to Slack | |
command: | | |
export GIT_COMMIT_DESC=$(git log --format=oneline -n 1 | sed -E 's/^[^ ]+ (.*)$/\1/g') | |
curl -F file=@app/build/outputs/apk/release/app-release.apk -F channels=$SLACK_CHANNEL -F token=$SLACK_API_TOKEN -F title="${CIRCLE_PROJECT_REPONAME} | branch -> ${CIRCLE_BRANCH} | commit -> ${GIT_COMMIT_DESC}" https://slack.com/api/files.upload | |
workflows: | |
version: 2 | |
deploy: | |
jobs: | |
- check-build: | |
filters: | |
branches: | |
ignore: | |
- master | |
- develop | |
- dev-build: | |
filters: | |
branches: | |
only: develop | |
- prod-build: | |
filters: | |
branches: | |
only: master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment