Skip to content

Instantly share code, notes, and snippets.

@helbertgs
Forked from pogramos/Fastfile
Created February 17, 2020 18:42
Show Gist options
  • Save helbertgs/7602c5f8e5eac42eb5e0f043021ea60f to your computer and use it in GitHub Desktop.
Save helbertgs/7602c5f8e5eac42eb5e0f043021ea60f to your computer and use it in GitHub Desktop.
Custom fastfile lanes
# Customize this file, documentation can be found here:
# https://docs.fastlane.tools/actions/
# All available actions: https://docs.fastlane.tools/actions
# can also be listed using the `fastlane actions` command
# Change the syntax highlighting to Ruby
# All lines starting with a # are ignored when running `fastlane`
# 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
fastlane_version "2.63.0"
default_platform :ios
platform :ios do
before_all do |options|
ENV["SLACK_URL"] = <Slack webhook url>
ENV["CRASHLYTICS_API_TOKEN"] = <fabric app token>
ENV["CRASHLYTICS_BUILD_SECRET"] = <fabric build secret>
# ENV["CRASHLYTICS_GROUPS"] = <Testers group name>
end
desc "Bumps patch version"
lane :patch_version do
increment_version_number(bump_type: "patch")
end
desc "Bumps minor version"
lane :minor_version do
increment_version_number(bump_type: "minor")
end
desc "Bumps major version"
lane :major_version do
increment_version_number(bump_type: "major")
end
desc "Get github commits as changelogs for beta versions"
lane :changelogs do
changelog_from_git_commits(
commits_count: 5,
pretty: "%C(auto)%h - %s%w(0,0,4)%n%b",# Optional, lets you provide a custom format to apply to each commit when generating the changelog text
date_format: "short",# Optional, lets you provide an additional date format to dates within the pretty-formatted string
match_lightweight_tag: false, # Optional, lets you ignore lightweight (non-annotated) tags when searching for the last tag
merge_commit_filtering: "exclude_merges" # Optional, lets you filter out merge commits
)
end
desc "Submit a new Beta Build to Crashlytics"
desc "This will also make sure the profile is up to date"
lane :build do |options|
scheme = (options[:scheme_name] != nil ? options[:scheme_name] : <dev scheme>)
exportOptions = { method: 'development', iCloudContainerEnvironment: 'Development' }
gym(scheme:scheme, workspace: <Workspace>, export_options: exportOptions, silent: true)
upload_beta
end
lane :beta do
build(scheme_name: <dev scheme>)
end
lane :betaQA do
build(scheme_name: <pre-prod scheme>)
end
desc "Submit a new Beta Build to Apple TestFlight"
lane :betaAppStore do
gym(
scheme: <scheme>,
export_options: {
iCloudContainerEnvironment: 'Production'
},
xcargs: "-allowProvisioningUpdates"
) # Build your app - more options available
changelogs
pilot(changelog: lane_context[:FL_CHANGELOG], skip_waiting_for_build_processing: true, distribute_external: true)
end
desc "Upload IPA to crashlytics"
lane :upload_beta do
changelogs
crashlytics
upload_symbols_to_crashlytics
end
desc "Update application metadata to ITC"
lane :metadata_update do
deliver(app: <appstoreconnect id>, app_identifier: <bundle identifier>, skip_screenshots: true, skip_binary_upload: true, force: true)
end
desc "Deploy a new version to the App Store"
lane :release do
deploy(should_release: true)
end
desc "Deploy a fix version to the App Store"
lane :deploy do |options|
should_release = options[:should_release] != nil ? options[:should_release] : false
gym(
scheme: <scheme>,
export_options: {
iCloudContainerEnvironment: 'Production'
},
xcargs: "-allowProvisioningUpdates"
)
# Build your app - more options available
deliver(force: true, skip_screenshots: true, submit_for_review: true, automatic_release: false)
tag(should_release: should_release)
end
lane :tag do |options|
should_release = options[:should_release] != nil ? options[:should_release] : false
if should_release
version = "#{get_version_number}"
add_git_tag(tag: version)
sh "git push origin #{version}"
end
end
# You can define as many lanes as you want
# after_all do |lane|
# slack(
# message: lane_context[:FL_CHANGELOG],
# success: true,
# payload: {
# "Build" => get_build_number,
# "Version" => get_version_number(target:<target>)
# },
# default_payloads: [:git_author, :git_branch, :lane]
# )
# end
#
# error do |lane, exception|
# slack(
# message: exception.message,
# success: false
# )
# end
end
# More information about multiple platforms in fastlane: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
# All available actions: https://docs.fastlane.tools/actions
# fastlane reports which actions are used. No personal data is recorded.
# Learn more at https://docs.fastlane.tools/#metrics
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment