BitBucket Pipelines Configuration

Sachith Ariyathilaka
2 min readDec 15, 2020

--

At present, most of your projects use CI/CD (continuous integration and continuous delivery) to make releases. In the BitBucket, they give pipelines for tracking the push of certain branches. We need to add a.yml file to our project to setup Bitbucket pipelines. But they give only the default Gradle, Maven, etc. If our project is for Android, we must manually set up the .yml file.

Step 01: Add the following code to your bitbucket-pipeline.yml file.

image: mingc/android-build-box:latest
pipelines:
default:
- step:
caches:
- gradle
script:
# Build apk
- chmod a+x ./gradlew
- ./gradlew assembleDebug
artifacts:
- app/build/outputs/apk/debug/*.apk
step:
script:
# Saving artifact
- curl -X POST - user BB_AUTH_STRING "https://api.bitbucket.org/2.0/repositories/{$username}/{$Repo_name}/downloads" - form files=@"./app/build/outputs/apk/debug/app-debug.apk"

This file needs to include your Android project. $username means a BitBucket username. $Repo_name means repository name, and finally, BB_AUTH_STRING can be generated earlier in my article from below.

Step 02: Go to BitBucket Repo -> Pipelines.

Now you need to enable pipelines by just clicking the enable pipeline button. Now you will automatically redact the build section. When the push comes to the master branch pipeline, identify it, build the project, and also save certain APKs to the download section as follows.

--

--

Sachith Ariyathilaka
Sachith Ariyathilaka

No responses yet