Skip to content

Deploying publicly available library dependencies

Kevin MacWhinnie edited this page Mar 7, 2016 · 3 revisions

Scope

This document covers the deployment process for the AnimeAndroidGo99 and Buruberi projects.

Prerequisites

The AnimeAndroidGo99 and Buruberi projects are both hosted on Bintray. You will need access to the hello-inc organization on Bintray to deploy. Any other Android team member can give you access, as well as Jimmy Lu, and Tim Bart. Once you've gotten access, you will need to generate an API key to use with the gradle deploy plugin.

To acquire your API key, navigate to your user profile page. The fastest way is to mouse over your username in the page header, and select Your Profile. Once on your profile page, press the Edit page on the header. Navigate to the API Key page. If you haven't yet generated an API key, press the Generate button. After generating an API key, you can copy it to your clipboard.

Now that you know your Bintray username and API key, you will need to add them to the local.properties file for the project you intend to deploy. Add the following lines to the bottom of your local.properties file:

bintrayUser=YourSnazzyUsername # <- replace with your username
bintrayApiKey=YourApiKey # <- replace with your API key
bintrayOrg=hello-inc

Preparation

After you've made your changes, be sure to add any applicable unit tests, and verify that the existing tests in the project still pass. After you've done this, you can update the VERSION_NAME variable at the top of the build.gradle file for the module you intend to deploy. In theory, both AnimeAndroidGo99 and Buruberi use semantic versioning. This means if you make any breaking changes, increment the major version part. For example, if you're starting with the base version 1.0.0:

  • You've made a minor bug fix: 2.0.1
  • You've added a new feature: 2.1.0
  • You've made a backwards incompatible change in API behavior: 2.0.0

Before you make a pull request, you should check that your changes work with our codebases by deploying to your local maven repository:

./gradlew clean build publishMavenJavaPublicationToMavenLocal

After you've completed these steps, create a pull request on the GitHub project to merge your changes into master. Once your changes have been merged into master, pull the latest changes onto your computer.

Deployment

Before you can upload a new artifact/module version to Bintray, you will need to create a new version. Navigate to the relevant maven projects page for the hello-inc organization. Find the project you intend to publish a new version for, and press the New Version button. Make sure the version name you enter matches the one in your build.gradle file.

Once you've created the new version on Bintray, run the following gradle command inside of your project directory:

./gradlew clean build bintrayUpload

After this command successfully completes, navigate to the version page on Bintray, and press the Publish button. Your artifacts are now publicly available for use.

Next, tag your release off master and push to the GitHub repository:

git tag 2.0.0
git push origin --tags

Lastly, you will need to create a new release on GitHub. On the GitHub project page, navigate to the Releases section from the tabs on the top of the file listing. Select Draft a new release, and select the tag you just pushed to GitHub. Make the release title the same as your tag name. Enter any changes you've made to the library in the describe this release section. If you've generated jar artifacts for the release, attach those to the release before pressing Publish release.

Addendum: Testing Changes Locally

Before you create a pull request to deploy your changes to one of the publicly available libraries, you will want to test your changes locally with our internal projects (e.g. suripu-android). To do this, you can deploy the libraries to your local maven repository like so:

# in project directory
./gradlew clean build publishLibraryPublicationToMavenLocal

Then, in your local copy of the suripu-android project, add a reference to maven local in your root project build.gradle file, like so:

// in `suripu-android/build.gradle`
// ...
allprojects {
    repositories {
        jcenter()
        mavenLocal()
        // ...
    }
}

Important: the maven local repository must come after any remote repositories.

You can then sync your project to pull in your local changes. Never push code to the remote repository with a maven local reference, it reduces the reproducibility of builds.