Created
November 5, 2019 08:20
-
-
Save bmbariah/03f70e6f45202699ef63b8572eff0e94 to your computer and use it in GitHub Desktop.
Bitbucket Pipeline android upload apk to slack
This file contains 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
image: mingc/android-build-box:1.12.0 | |
pipelines: | |
branches: | |
master: | |
- step: | |
caches: | |
- gradle | |
- gradlewrapper | |
- androidavd | |
script: | |
- bash ./gradlew assemble | |
# FETCH LAST COMMIT MESSAGE | |
- export LAST_COMMIT_MESSAGE=`git log -1 --pretty=%B` | |
- export BUILD_DATE=`date "+%Y/%m/%d@%H:%M:%S"` | |
# CHANNEL_TOKEN - From here: https://api.slack.com/custom-integrations/legacy-tokens | |
# CHANNEL - Your slack channel name to upload the apk | |
- mv "./app/build/outputs/apk/debug/app-debug.apk" "./app-${BITBUCKET_BRANCH}-${BITBUCKET_BUILD_NUMBER}.apk" | |
- curl -F file=@"app-${BITBUCKET_BRANCH}-${BITBUCKET_BUILD_NUMBER}.apk" -F channels=$CHANNEL -F "initial_comment=Pipeline Build on $BUILD_DATE -- $LAST_COMMIT_MESSAGE" -F token=$CHANNEL_TOKEN https://slack.com/api/files.upload | |
definitions: | |
caches: | |
gradlewrapper: ~/.gradle/wrapper | |
androidavd: $ANDROID_HOME/.android/avd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This allows you to push your latest apk build to a slack channel alongside a message( usually the commit message)