Skip to content

Instantly share code, notes, and snippets.

@yashigani
Last active August 29, 2015 13:56
Show Gist options
  • Save yashigani/8862969 to your computer and use it in GitHub Desktop.
Save yashigani/8862969 to your computer and use it in GitHub Desktop.
Create ipa and upload it to testflight.
SDK = 'iphoneos7.0'
PRODUCT_NAME = ''
CODE_SIGN_IDENTITY = ''
PROVISIONING_PROFILE_UUID = ''
TESTFLIGHT_API_TOKEN = ''
TESTFLIGHT_TEAM_TOKEN = ''
desc "Clean build dir"
task :clean do
sh "xcodebuild clean CONFIGURATION_BUILD_DIR=${PWD}/build"
sh "rm -rf build"
end
desc "Make AdHoc build"
task :adhoc do
sh "xcodebuild -sdk #{SDK} -workspace #{PRODUCT_NAME}.xcworkspace -scheme #{PRODUCT_NAME} -configuration Release clean build CONFIGURATION_BUILD_DIR=$(PWD)/build CODE_SIGN_IDENTITY='#{CODE_SIGN_IDENTITY}' PROVISIONING_PROFILE='#{PROVISIONING_PROFILE_UUID}'"
end
file "#{PRODUCT_NAME}.app" => :adhoc
file "#{PRODUCT_NAME}.app.dSYM" => :adhoc
desc "Make .ipa"
task :ipa => "#{PRODUCT_NAME}.ipa"
file "#{PRODUCT_NAME}.ipa" => ["#{PRODUCT_NAME}.app", "#{PRODUCT_NAME}.app.dSYM"] do
sh "xcrun -sdk iphoneos PackageApplication build/#{PRODUCT_NAME}.app -o ${PWD}/build/#{PRODUCT_NAME}.ipa --embed #{PROVISIONING_PROFILE_UUID}.mobileprovision"
cd "build" do
sh "zip -r #{PRODUCT_NAME}.app.dSYM.zip #{PRODUCT_NAME}.app.dSYM/"
end
end
desc "Upload AdHoc .ipa to TestFlight"
task :testflight => ["#{PRODUCT_NAME}.ipa", "ChangeLog"] do
note = `cat ChangeLog`
sh <<-EOS
curl http://testflightapp.com/api/builds.json \
-F file=@build/#{PRODUCT_NAME}.ipa \
-F dsym=@build/#{PRODUCT_NAME}.app.dSYM.zip \
-F api_token='#{TESTFLIGHT_API_TOKEN}' \
-F team_token='#{TESTFLIGHT_TEAM_TOKEN}' \
-F notes='#{note}' \
-F notify=True \
-F distribution_lists='Internal'
EOS
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment