Created
May 13, 2019 11:02
-
-
Save ronal2do/7e7d0efb52b29355b036660033168e8e 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
# Fastfile | |
# | |
# Author: Ronaldo Lima <[email protected]> | |
# | |
# ----------------------------------------------------------- | |
# | |
# Version bumping, the default type is `patch` | |
# Run: | |
# `fastlane ios bump` | |
# `fastlane ios beta [type:major|minor|patch]` | |
# | |
# ----------------------------------------------------------- | |
# | |
# Deploying to TestFlight: | |
# Running this command will result in a `patch` version: | |
# `fastlane ios beta` | |
# | |
# ----------------------------------------------------------- | |
# | |
# Deploying to iTunes Store | |
# Run: | |
# `fastlane ios release` | |
# | |
# Requires | |
require 'yaml' | |
require 'ostruct' | |
# Fastlane defaults | |
fastlane_version '2.41.0' | |
default_platform :ios | |
# Fastlane configuration data | |
config = OpenStruct.new( | |
YAML.load_file('fastlane_config.yml') | |
) | |
# Configuration for iOS | |
# Available lanes: `beta` and `release` | |
platform :ios do | |
# This command will run before all lanes, | |
# it will install all dependencies from cocoapods | |
# and will configure the slack url from `fastlane_config.yml` | |
before_all do | |
ENV['SLACK_URL'] = config.slack_url | |
end | |
# Lane: bump | |
# It will push to bitbucket a commit with an app's | |
#incremented version | |
desc 'Bumps the current version of the App' | |
lane :bump do |options| | |
# Increment current version of the app | |
version = increment_version_number_in_plist( | |
target: config.target, | |
bump_type: options[:bump_type] || 'patch' | |
) | |
# Create version bump commit | |
commit_version_bump( | |
message: "[Fastlane] Version Bump: #{version}", | |
xcodeproj: config.xcodeproj, | |
force: true | |
) | |
# Push bump commit to current branch | |
push_to_git_remote( | |
local_branch: git_branch, | |
force: true | |
) | |
end | |
# Lane: beta | |
# Responsible to deploy a new version of the app | |
# to iTunesConnect and make it available to TestFlight | |
desc 'Submit a new Beta Build to Apple TestFlight' | |
lane :beta do | |
# Install pods | |
cocoapods | |
# Sync certificates | |
match( | |
type: "appstore", | |
git_url: config.git_certificates_url, | |
readonly: true | |
) | |
disable_automatic_code_signing(path: config.xcodeproj) | |
# Create a build of the app | |
gym( | |
scheme: config.scheme | |
) | |
enable_automatic_code_signing(path: config.xcodeproj) | |
# Push the build to itunes connect | |
pilot( | |
skip_waiting_for_build_processing: true | |
) | |
# upload_symbols_to_bugsnag # Upload dSYM files to Bugsnag | |
# Slack notification | |
slack( | |
message: config.beta_success, | |
success: true, | |
default_payloads: [:lane, :test_result, :git_branch, :git_author] | |
) | |
end | |
# Lane: release | |
# Resposible to create a new release of the app | |
# and deploy to App Store | |
desc 'Deploy a new version to the App Store' | |
lane :release do | |
# Install pods | |
cocoapods | |
# Sync certificates | |
match( | |
type: 'appstore', | |
git_url: config.git_certificates_url | |
) | |
# Take automized localized screenshots | |
#snapshot | |
# Create a build of the app | |
gym | |
# Upload screenshots, metadata, and the app to the App Store | |
deliver(force: true) | |
# Slack notification | |
slack( | |
message: config.release_success, | |
success: true, | |
default_payloads: [:lane, :test_result, :git_branch, :git_author] | |
) | |
end | |
# Error handling | |
error do |lane, exception| | |
# Slack notification | |
# 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