Skip to content

Instantly share code, notes, and snippets.

@ppm
Created October 14, 2019 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ppm/c7a9f7e3e9c1ba4aeec8a889f6a1c666 to your computer and use it in GitHub Desktop.
Save ppm/c7a9f7e3e9c1ba4aeec8a889f6a1c666 to your computer and use it in GitHub Desktop.
Use this in Bitrise's Ruby Script runner step to increment CURRENT_PROJECT_VERSION.
# Gemfile:
#
# source 'https://rubygems.org'
#
# gem 'xcodeproj'
require 'xcodeproj'
project_path = 'Your.xcodeproj'
project = Xcodeproj::Project.open(project_path)
target = project.targets.find { |target| target.name == 'TargetName' }
target.build_configurations.each do |config|
new_version = (config.build_settings['CURRENT_PROJECT_VERSION'].to_i + 1).to_s
config.build_settings['CURRENT_PROJECT_VERSION'] = new_version
end
project.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment