Automating PhoneGap Builds

I’ve recently had several conversations with PhoneGap users around processes for automating the compilation of PhoneGap apps.  This could be either in automated tasks using GruntAntMaven, or any other task manager, or could be in continuous integration environments like Jenkins CI.

If you’re interested in this, here are a few options… First of all, PhoneGap Build has a REST API. You can use this to programmatically create new projects, update projects, trigger new builds (even just for specific platforms), etc… This can integrate with your build scripts and tie into any workflow.

If you’re using GitHub, it is possible to tie into hooks triggering PhoneGap Build to recompile every time you commit your code.  Here’s an example of it in action, or you can just use this service which is already setup: http://autobuild.monkeh.me/ (from the same author) - Just be careful with your user/pass in plain text. Update: You can also use the Autobuild service using a clientID variable instead of sending through username and password details via HTTP.

If you aren’t using PhoneGap Build, you’re not out of luck.  All PhoneGap CLI commands are based on scripts, which themselves can be scripted.  You could use ANT’s exec command, the Maven exec plugin, Grunt exec or Grunt shell plugins, Jenkins execute shell, or any other task runner to manually invoke the PhoneGap CLI. You just need to make sure all your environment and path variables are correct to access SDKs and required programs. However, there’s one caveat… iOS builds require Xcode/Apple developer tools, which have to be run on a Mac.

If you’re using Jenkins, this might be a good one to check out: Jenkins CI + PhoneGap & Cordova

  • coldfumonkeh

    Hi Andy. Thanks for mentioning the Autobuild service. The link seems a little messed up (I think something went wrong with a double-quote mark somewhere).

    It’s also possible to use the Autobuild service using a clientID variable instead of sending through username and password details via HTTP (albeit behind the scenes in Github) should the user wish to do that instead.

  • http://www.linkworxseo.com/ Link Worx Seo

    Have been trying to dive more into PhoneGap. Ray Camden provides a lot of good input and has caught my attention with his blog post.

  • Denis Bulichenko

    Hi Andy! Thanks for mentioning our blog post with step by step Jenkins configuration guide :-) Before automatic builds working on many external projects was a complete mess. Developers spent so much time building small changes / adding test accounts / dealing with a build outside of the office. Now we start every project with configuring automatic builds system.