Skip to content

Instantly share code, notes, and snippets.

@natanrolnik
Last active July 20, 2017 23:06
Show Gist options
  • Save natanrolnik/d61086044112e327abe5 to your computer and use it in GitHub Desktop.
Save natanrolnik/d61086044112e327abe5 to your computer and use it in GitHub Desktop.
fastlane_version "1.33.0"
default_platform :ios
platform :ios do
before_all do
cocoapods
ENV['KEYCHAIN_NAME'] = "TempKeychain.keychain"
end
desc "Submit a new Beta Build to Fabric without e-mail notifications"
lane :fabric_silent do
import_certificates
sigh(adhoc: true)
ENV["PROFILE_UDID"] = lane_context[SharedValues::SIGH_UDID] # use the UDID of the newly created provisioning profile
gym(scheme: "MyApp AdHoc", sdk: "iphoneos9.0", use_legacy_build_api: true)
crashlytics(notifications: false)
end
desc "Submit a new Beta Build to Apple TestFlight"
desc "This will also make sure the profile is up to date"
lane :beta do
import_certificates
sigh
ENV["PROFILE_UDID"] = lane_context[SharedValues::SIGH_UDID]
puts "Using profile #{ENV["PROFILE_UDID"]}"
gym(scheme: "MyApp AdHoc", sdk: "iphoneos9.0", use_legacy_build_api: true)
pilot(skip_submission: true)
end
desc "Deploy a new version to the App Store"
desc "** Full Markdown** Support: `code`"
lane :appstore do
import_certificates
sigh
ENV["PROFILE_UDID"] = lane_context[SharedValues::SIGH_UDID]
gym(scheme: "MyApp Release", sdk: "iphoneos9.0", use_legacy_build_api: true)
snapshot
deliver(skip_deploy: true, force: true)
end
after_all do |lane|
notify "Fastlane succeeded '#{lane}'" unless Helper.is_ci? #if I'm running it locally, show a terminal OS X notification
push_notify(lane, "Succeeded") #check the bonus part!
end
error do |lane, exception|
notify "Fastlane failed '#{lane}'" unless Helper.is_ci? #if I'm running it locally, show a terminal OS X notification
push_notify(lane, "Failed") #check the bonus part!
end
def import_certificates
return unless Helper.is_ci? # As in my local machine I don't need to import the certificates, only run if it's in the CI
create_keychain(
name: ENV["KEYCHAIN_NAME"],
default_keychain: true,
unlock: true,
timeout: 3600,
lock_when_sleeps: true,
password: ENV["KEYCHAIN_PASSWORD"]
)
import_certificate(
certificate_path: "fastlane/certificates/distribution.p12",
certificate_password: ENV['CERT_PASSWORD'],PA
keychain_name: ENV["KEYCHAIN_NAME"]
)
import_certificate(
certificate_path: "fastlane/certificates/ios_distribution.cer",
keychain_name: ENV["KEYCHAIN_NAME"]
)
end
#BONUS!
def push_notify(lane_name, success)
require 'uri'
uri = URI.parse("https://api.parse.com/")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new("/1/classes/LaneResult")
request.add_field('Content-Type', 'application/json')
request.add_field('X-Parse-Application-Id', 'my_parse_id')
request.add_field('X-Parse-Master-Key', 'my_parse_key')
request.body = {"EventType"=> "Deploy #{lane_name} - #{success}",
"App"=> "MyIndieApp"}.to_json
response = http.request(request)
end
end
@ipavlidakis
Copy link

@bartonhammond probably no. I am using that import_certificate without that and is working like a charm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment