Skip to content

Instantly share code, notes, and snippets.

@pdesantis
Created February 11, 2016 22:58
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pdesantis/f70a98635f4a3bdd011a to your computer and use it in GitHub Desktop.
Save pdesantis/f70a98635f4a3bdd011a to your computer and use it in GitHub Desktop.
An example Fastfile
# This is the minimum version number required.
# Update this, if you use features of a newer version
fastlane_version "1.41.0"
default_platform :ios
platform :ios do
before_all do
ENV["SLACK_URL"] = "https://hooks.slack.com/services/MoneyWithWings"
# Make sure there are no uncommitted changeds
ensure_git_status_clean
# Update cocoapods
cocoapods
end
desc "Build and sign the app"
private_lane :build_app do |options|
increment_build_number
# Build the app
gym(
workspace: "MoneyWithWings.xcworkspace",
scheme: "MoneyWithWings Beta",
configuration: "Release"
)
end
desc "Submit a new Beta Build to Apple TestFlight"
desc "This action will also do a build version bump and push it to git."
lane :beta do
build_app
pilot(
skip_submission: true
)
# Make sure our directory is clean, except for changes Fastlane has made
clean_build_artifacts
version_number = get_version_number
build_number = get_build_number
tag = "beta/#{version_number}/#{build_number}"
commit_version_bump(
message: "Version Bump to #{version_number}-#{build_number}"
)
add_git_tag(tag: tag)
push_to_git_remote
end
# On success, post in Slack!
after_all do |lane|
slack(
message: "💸💸💸 Successfully deployed new iOS App Update 💸💸💸"
)
end
# On failure, let us know what went wrong in Slack, and then revert the git repo to the previous state.
error do |lane, exception|
slack(
message: exception.message,
success: false
)
reset_git_repo
end
end
@macecchi
Copy link

macecchi commented Apr 27, 2016

If you're incrementing the build number and tagging it after build_app and pilot, doesn't that mean the uploaded build will always be one number behind what is tagged?

EDIT: Nevermind, I just noticed that the incrementing is done before the build, and only the commit and tag are done after it. Nice job :)

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