Created
October 23, 2015 17:13
-
-
Save pmairoldi/0153032f626f0552da20 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fastlane_version "1.34.0" | |
before_all do | |
keys | |
end | |
desc "Sets up private keys" | |
private_lane :keys do | |
require 'cocoapods-core' | |
puts "Validating CocoaPods Keys" | |
Dir.chdir ".." do | |
podfile = Pod::Podfile.from_file "Podfile" | |
target = podfile.plugins["cocoapods-keys"]["target"] || "" | |
podfile.plugins["cocoapods-keys"]["keys"].each do |key| | |
puts " - #{key}" | |
value = `bundle exec pod keys get #{key} #{target}` | |
value = value.split("]").last.strip | |
if value == "-" || value == "" | |
raise "Did not pass validation for key #{key}. Run `bundle exec pod keys get #{key} #{target}` to see what it is. It's likely this key is invalid.".red | |
elsif value == "Could not find value" | |
raise "Key #{key} has not been set run `bundle exec pod keys set #{key} YOUR_KEY` to set it.".red | |
end | |
end | |
end | |
end | |
desc "Builds app and packages it" | |
private_lane :build do |options| | |
# Make sure we start off with a clean slate | |
ensure_git_status_clean | |
ensure_git_branch branch: 'master' | |
if !options[:version] | |
raise 'No Version Specified. Enter a version by adding "version:version_number"'.red | |
end | |
scan | |
# Increment to the changelog version number | |
version_number = options[:version] | |
increment_version_number version_number: version_number | |
# Increment build number to current date | |
increment_build_number | |
if options[:screenshots] | |
snapshot | |
end | |
cert | |
sigh | |
gym | |
if options[:beta] | |
pilot | |
else | |
deliver force: true, submit_for_review: false | |
end | |
# Make sure our directory is clean, except for changes Fastlane has made | |
clean_build_artifacts | |
# Tag release and push to remote | |
commit_version_bump message: "Deploying version #{version_number}." | |
add_git_tag tag: version_number | |
push_to_git_remote | |
end | |
desc "Sets up the project" | |
lane :bootstrap do | |
cocoapods | |
storyboard_ids | |
synx | |
end | |
desc "Generates storyboard ids" | |
lane :storyboard_ids do | |
sh "cd .. ; bundle exec sbconstants Improvement/App/Storyboards/Identifiers.swift -w -s Improvement" | |
end | |
desc "Organizes project folders" | |
lane :synx do | |
sh "cd .. ; bundle exec synx Improvement.xcodeproj" | |
end | |
desc "Runs all the tests" | |
lane :tests do | |
scan | |
end | |
desc "Submit a new Beta Build to Apple TestFlight" | |
lane :beta do |options| | |
build version: options[:version], beta: true, screenshots: options[:screenshots] | |
end | |
desc "Deploy a new version to the App Store" | |
lane :release do |options| | |
build version: options[:version], screenshots: options[:screenshots] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment