Skip to content

Instantly share code, notes, and snippets.

@appplemac
Created January 29, 2016 08:58
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 appplemac/e3908e8040341236de6e to your computer and use it in GitHub Desktop.
Save appplemac/e3908e8040341236de6e to your computer and use it in GitHub Desktop.
# If you want to automatically update fastlane if a new version is available:
# update_fastlane
# This is the minimum version number required.
# Update this, if you use features of a newer version
$:.unshift File.dirname(__FILE__)
require 'lib/utils.rb'
require 'shellwords'
fastlane_version "1.39.0"
default_platform :ios
platform :ios do
before_all do
# ENV["SLACK_URL"] = "https://hooks.slack.com/services/..."
# cocoapods
# increment_build_number
# xctool # run the tests of your app
end
desc "Runs all the tests"
lane :test do
snapshot
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
sigh
gym # Build your app - more options available
#pilot
# sh "your_script.sh"
# You can also use other beta testing services here
end
desc "Deploy a new version to the App Store"
lane :deploy do
snapshot
sigh
gym # Build your app - more options available
# deliver(force: true)
# frameit
end
desc "Local MyApp Test Build - ad-hoc"
lane :testBuildLocaly do
scan(
scheme: "MyApp Test"
)
gym(
workspace: 'MyApp.xcworkspace',
scheme: 'MyApp Test',
export_method: 'ad-hoc'
)
end
desc "Submit a new MyApp Test Build to HockeyApp"
lane :inhouse do |options|
scan(
scheme: "MyApp Test"
)
# Set version number (2.0.<CI build number>.<git-hash>)
if options[:circleci_build_number]
# Get version stored in plist file
plist_version = get_version_short_string File.expand_path(File.join(ENV['PWD'], "MyApp/project/MyApp Test.plist".shellescape))
plist_version_segments = plist_version.split(".")
# Compose custom version number (X.X.BUILD)
build_version_number = plist_version_segments[0] + "." + plist_version_segments[1] + "." + options[:circleci_build_number]
if options[:git_hash]
# Add git hash as version number sufix (X.X.BUIL.HASH)
build_version_number += "." + options[:git_hash][0..6]
end
increment_version_number(
version_number: build_version_number
)
increment_build_number(
build_number: options[:circleci_build_number].to_i
)
end
gym(
workspace: 'MyApp.xcworkspace',
scheme: 'MyApp Test',
export_method: 'ad-hoc',
use_legacy_build_api: true # Hint: https://github.com/fastlane/gym/issues/104
)
hockey({
api_token: ENV['HOCKEYAPP_TOKEN'],
ipa: './build_output/MyApp_Test.ipa',
notes: Actions.last_git_commit
})
end
desc "Run unit tests - MyApp Test"
lane :onlyUnitTests do
scan(
scheme: "MyApp Test"
)
end
after_all do |lane|
# This block is called, only if the executed lane was successful
if ENV["SLACK_URL"]
slack(
channel: "#repositories",
message: nil,
success: true,
default_payloads: [:test_result, :git_branch]
)
end
end
error do |lane, exception|
if ENV["SLACK_URL"]
slack(
channel: "#repositories",
message: exception.to_s,
success: false
)
end
end
end
# More information about multiple platforms in fastlane: https://github.com/KrauseFx/fastlane/blob/master/docs/Platforms.md
# All available actions: https://github.com/KrauseFx/fastlane/blob/master/docs/Actions.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment