Freitag, 22. Mai 2015

Moving my Blog

I have moved my Blog over to Github Pages. This allows me to author my posts with tools I know and love - like Markdown. So if you found value in my posts so far, be sure to change your subscription and thank you for supporting me =)

Montag, 15. Dezember 2014

My Lightweight Release Process

"If it's not on Maven Central, it doesn't exist!"

I always feel sad when I see a nice little library and the usage instructions say something like "download the jar and put it on your project's classpath". It's 2014 and your project deserves to be in a public repository!

But getting it there can be tedious without the right tools. Not only should you build a jar, you also want sources and javadoc, all of them digitally signed. On top of that you need to provide lots of metadata in the form of a pom.xml, espescially if you want to be listed on Maven Central.

This is why I created a Gradle plugin that automates as much of the metadata collection and publishing as possible. The goal is to just push a tag to Github and have the released artifacts available on public repositories a few minutes later without any manual steps.

An example configuration looks like this:


A Maven Central compliant POM can be completely derived from that little script. SCM information, project URL and issue management URL are all calculated from the github username and project name. The license is taken from the LICENSE file in the project root directory. The devolopers section is copied from the defined contacts.

The plugin allows you to call a release task and supply the version number on the command line. This is very useful for patterns like "release on tag" or "release on every commit". But you could also easily extend it to display a modal dialog and ask for the required information if you want to do manual releases.

I do my releases on every tag that is pushed to the Github repository. On travis-ci this only requires a short script and setting the passwords as environment variables. The steps are described at the end of the readme.

With this plugin, the only manual steps left are one-time tasks like getting a Sonatype account and creating signing keys. After that, you can build and release new projects within minutes.

Travis CI: Replicating Environment Variables

I have quite a few open source projects that I wish to build/release automatically on pushes/tags. For the release, I need the same environment variables (passwords and API keys) in all of my builds. Unfortunately, Travis currently only allows setting them per project. This quickly becomes annoying, especially if you ever have to change a password.

I worked around this by having a seed job where I configure these variables. That job then uses the Travis Ruby-API to push those variables to all other of my build jobs. Feel free to fork the repo and adjust the code to your own needs.