Created
March 3, 2015 15:45
-
-
Save joewright/64291e2f07f4d0db490f to your computer and use it in GitHub Desktop.
Grunt task to bump Testflight build number for Titanium projects
This file contains hidden or 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
//load tiapp.xml in grunt config | |
grunt.initConfig({ | |
// This line makes your node configurations available for use | |
pkg: grunt.file.readJSON('package.json'), | |
tiapp: require('tiapp.xml').load('./tiapp.xml'), | |
//... | |
//........... | |
grunt.registerTask('buildbump', function() { | |
console.log('be sure to check that "ios.skipAppIdValidation" is set to true \n\n ti config ios.skipAppIdValidation true\n'); | |
var tiapp = grunt.config.data.tiapp; | |
var current = tiapp.version; | |
var newVersion; | |
if (current.split('.').length === 3) { | |
newVersion = current + '.0'; | |
} else if (current.split('.').length === 4) { | |
var oldVal = current.split('.').pop(); | |
oldVal = parseInt(oldVal, 10); | |
var newVal = oldVal + 1; | |
newVersion = current.split('.'); | |
newVersion.splice(3, 1); | |
newVersion = newVersion.join('.'); | |
newVersion += '.' + newVal; | |
} | |
console.log('bump from', current, 'to', newVersion); | |
tiapp.version = newVersion; | |
tiapp.write(); | |
grunt.config.set('tiapp', tiapp); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment