Skip to content

Instantly share code, notes, and snippets.

@cybertk
Last active March 4, 2016 18:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cybertk/24ce4d20d76f9d6a16c6 to your computer and use it in GitHub Desktop.
Save cybertk/24ce4d20d76f9d6a16c6 to your computer and use it in GitHub Desktop.
Update version in AndroidManifest.xml
task :update_build_number do
File.open('AndroidManifest.xml', 'r+') do |f|
manifest = f.read
build = ENV['TRAVIS_BUILD_NUMBER'] || 0
# Update version
manifest = manifest.gsub(
/android:versionCode=".*"/, "android:versionCode=\"#{build}\"")
# Write back
f.rewind
f.truncate(0)
f.write(manifest)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment