Skip to content

Instantly share code, notes, and snippets.

@mps
Created June 27, 2013 13:21
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mps/5876345 to your computer and use it in GitHub Desktop.
Save mps/5876345 to your computer and use it in GitHub Desktop.
source 'http://rubygems.org'
# Make sure you have bundler installed
# gem install bundler
gem 'shenzhen'
PROJECT_SCHEME = '' # Your Project scheme for building ex MyApp
PROJECT_NAME = '' # Your Project file name ex. MyApp.xcodeproj
API_TOKEN = '' # Your TestFlight API Token
TEAM_TOKEN = '' # Your TestFlight Team Token
INTERNAL_LIST = '' # TestFlight list of people you want to notify internally
RELEASE_LIST = '' # TestFlight list of people you want to notify for release
desc 'Build Handset IPA'
task :buildipa do
sh "rm -rf *.ipa"
sh "rm -rf *.app.dSYM.zip"
sh "ipa build --scheme #{PROJECT_SCHEME} --project #{PROJECT_NAME} --configuration Release --clean /tmp"
end
desc 'Deploy Internal Build to Testflight'
task :internal => ['buildipa'] do
sh "ipa distribute:testflight --api_token #{API_TOKEN} --team_token #{TEAM_TOKEN} --lists #{INTERNAL_LIST} --notify --notes 'Internal Release' "
end
desc 'Deploy Release Build to Testflight'
task :release => ['buildipa'] do
sh "ipa distribute:testflight --api_token #{API_TOKEN} --team_token #{TEAM_TOKEN} --lists #{RELEASE_LIST} --notify "
end
def revBuild(plistFile)
puts "Attempting to update #{plistFile} build version..."
oldVersion = `/usr/libexec/PlistBuddy -c "Print CFBundleVersion" #{plistFile}`
puts "The old version: #{oldVersion}"
versionParts = oldVersion.split(".")
previousDate = versionParts[2]
newDate = Time.now.strftime("%Y%m%d")
versionParts[2] = newDate
versionParts[3] = previousDate == versionParts[2] ? (versionParts[3].to_i+1).to_s : "1"
versionParts.each do |part|
part.chomp!
end
newVersion = versionParts.join(".")
`/usr/libexec/PlistBuddy -c "Set :CFBundleVersion #{newVersion}" #{plistFile}`
puts "The new version: #{newVersion}"
end
desc "Rev the build numbers in a project's plist"
task :rev do
revBuild './path/to/my.plist'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment