Skip to content

Instantly share code, notes, and snippets.

@PH9
Last active February 20, 2018 06:06
Show Gist options
  • Save PH9/99c75262b320903364b82d33f0534f8d to your computer and use it in GitHub Desktop.
Save PH9/99c75262b320903364b82d33f0534f8d to your computer and use it in GitHub Desktop.
One of fastlane's file (Fastfile) for my project
fastlane_version "2.81.0"
default_platform :ios
platform :ios do
before_all do
ENV["GITHUB_API_TOKEN="] ||= "YOUR GITHUB TOKEN"
ENV["SLACK_URL"] ||= "YOU SLACK URI"
ENV["CRASHLYTICS_API_TOKEN"] ||= "YOUR CRASHLYTICS_API_TOKEN"
ENV["CRASHLYTICS_BUILD_SECRET"] ||= "YOUR CRASHLYTICS_BUILD_SECRET"
end
desc "Runs all the tests"
lane :test do
cocoapods
carthage(verbose: true, platform: "iOS", use_binaries: false)
scan
end
desc "Build App - Test [NO BUMPING VERSION]"
lane :only_build_test_no_bump do
config = "Test"
cocoapods
carthage(verbose: true, platform: "iOS", use_binaries: false)
gym(
scheme: "dtac One",
configuration: config,
output_name: "iosapp-#{config}.ipa",
export_method: "ad-hoc"
)
end
desc "Build App - Test [BUMP VERSION]"
lane :build_test do
increment_build_number
only_build_test_no_bump
crashlyticsBetaUpload(configuration: "Test")
my_commit_version_bump
end
desc "Commit - the build number and push to git remote"
lane :my_commit_version_bump do
commit_version_bump(
message: "📦 Build Number Bump to #{get_build_number}",
xcodeproj: "iosapp.xcodeproj"
)
push_to_git_remote
end
desc "Upload - test app to crashlytics beta"
lane :crashlyticsBetaUpload do |options|
config = options[:configuration]
config ||= "Test"
commit = last_git_commit
commit_message = commit[:message]
git_commit_notes = changelog_from_git_commits(
between: [last_git_tag, 'HEAD'],
pretty: '• %s',
merge_commit_filtering: 'exclude_merges'
)
crashlytics(
notes: git_commit_notes,
ipa_path: "./build/iosapp-#{config}.ipa",
groups: "atom",
notifications: true
)
clean_build_artifacts
rocket
slack(
payload: {
'Lane' => "#{config}",
'App Version' => "#{get_version_number} (#{get_build_number})",
'Note' => git_commit_notes
},
default_payloads: [:git_branch, :git_author]
)
end
desc "Deploy a new version to the Testflight"
lane :build_testflight do
ensure_git_status_clean
cocoapods
# carthage(verbose: true, platform: "iOS", use_binaries: false)s
gym(
scheme: "dtac One",
configuration: "Release",
output_name: "iosapp-Release.ipa",
export_method: "app-store",
include_bitcode: true
)
pilot(
username: "phai@live.com",
ipa: "./build/#{output_name}",
skip_waiting_for_build_processing: true,
)
rocket
git_commit_notes = changelog_from_git_commits(
between: [last_git_tag, 'HEAD'],
pretty: '• %s',
merge_commit_filtering: 'exclude_merges'
)
set_github_release(
repository_name: "PH9/iOSRTR",
api_token: ENV["GITHUB_API_TOKEN"],
name: "#{get_version_number} (#{get_build_number})",
tag_name: "store/#{get_version_number}-#{get_build_number}",
description: git_commit_notes,
upload_assets: [
lane_context[SharedValues::XCODEBUILD_ARCHIVE],
lane_context[SharedValues::IPA_OUTPUT_PATH],
lane_context[SharedValues::DSYM_OUTPUT_PATH]
],
is_draft: false
)
# NO NEED TO UPLOAD SYMBOLS TO CRASHLYTICS ANYMORE AFTER ENABLING BITCODE
# YOU SHOOLD `refresh_dsym` INSTEAD AFTER ITUNES CONNECT FINISH ITS PROCESS.
# upload_symbols_to_crashlytics
clean_build_artifacts
end
desc "Retry Upload release app - to itunes connect"
lane :pilot_only do
pilot(
username: "phai@live.com",
ipa: "./build/iosapp-Release.ipa",
skip_waiting_for_build_processing: true,
)
rocket
end
desc "Download - only latest dsym from itunes connect and upload to crasglytics"
lane :refresh_dsym do
download_dsyms(version: 'latest')
upload_symbols_to_crashlytics
clean_build_artifacts
end
desc "Download - all dsyms from itunes connect and upload to crasglytics"
lane :refresh_dsyms do
download_dsyms
upload_symbols_to_crashlytics
clean_build_artifacts
end
desc "Download and refresh and profile"
lane :sync_cert do
match(type: "development", app_identifier: "com.github.ph9.iosapp.debug")
match(type: "adhoc", app_identifier: "com.github.ph9.iosapp.test")
match(type: "appstore", app_identifier: "com.github.ph9.iosapp", force_for_new_devices: false)
end
error do |lane, exception|
slack(
message: exception.message,
success: false
)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment