-
-
Save manishkpr/291e3b6ac5119229a1393dc635f3e709 to your computer and use it in GitHub Desktop.
Fastlane Beta
This file contains hidden or 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
desc "" | |
lane :beta do |lane| | |
# ensure you are in master branch | |
ensure_git_branch | |
# ensure that master branch is clean | |
ensure_git_status_clean | |
# check the semantic parameter entered | |
if !lane[:bump] | |
raise "No bump type defined! Use one of: patch | minor | major".red | |
end | |
# get the last commit comments from Git history | |
# and creates our changelog | |
comments = changelog_from_git_commits( | |
between: [last_git_tag, "HEAD"], | |
pretty: "- %s", | |
date_format: "short", | |
match_lightweight_tag: false, | |
merge_commit_filtering: "exclude_merges" | |
) | |
# calculates the new version according to | |
# the semantic version added | |
type = lane[:bump] | |
old = last_git_tag | |
version = old | |
old[0] = '' | |
oldArr = old.split('.').map{|v| v.to_i} | |
if type == "patch" | |
version = "#{oldArr[0]}.#{oldArr[1]}.#{oldArr[2] + 1}" | |
elsif type == "minor" | |
version = "#{oldArr[0]}.#{oldArr[1] + 1}.0" | |
elsif type == "major" | |
version = "#{oldArr[0] + 1}.0.0" | |
end | |
if version == old | |
UI.user_error!("Wrong release type parameter. Enter: patch | minor | major") | |
end | |
# set the new version number | |
increment_version_number( | |
version_number: version | |
) | |
# increment build number | |
increment_build_number | |
# manage the certificates | |
cert | |
# manage the provisioning profiles | |
sigh( | |
adhoc: true | |
) | |
# build the iOS app | |
gym( | |
scheme: "YourScheme", | |
export_method: "ad-hoc", | |
export_options: { | |
provisioningProfiles: { | |
"com.yourdomain.iphoneApp" => "name_used" | |
} | |
} | |
) | |
# creates a bump version commit | |
commit_version_bump( | |
message: "Version bumped to v#{version}", | |
xcodeproj: "AppProject.xcodeproj" | |
) | |
# push bump commit | |
push_to_git_remote( | |
tags: false | |
) | |
# create a local tag with the new version | |
add_git_tag( | |
message: comments, | |
tag: "v#{version}", | |
prefix: "v", | |
build_number: version | |
) | |
# publish a new release into Github | |
github_release = set_github_release( | |
api_token: ENV["GITHUB_TOKEN"], | |
repository_name: "your-repo-user/iphone-repo", | |
name: "#{type.capitalize} version v#{version}", | |
tag_name: "v#{version}", | |
description: comments, | |
commitish: "master" | |
# upload_assets: no assets supported | |
) | |
# Finally, publish the .ipa on Fabric | |
fabric | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment