Last active
November 20, 2017 20:33
-
-
Save RishabhTayal/dd96da18921a172399abed16a829319d to your computer and use it in GitHub Desktop.
Fastfile
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
platform :ios do | |
desc "\033[1mDeploy PersonalShopper to iTunes Connect\033[0m" | |
desc "This action does the following:" | |
desc "- Post the message on Slack" | |
desc "- Input version number from user" | |
desc "- Increament version number" | |
desc "- Increament build number" | |
desc "- Generate build" | |
desc "- Push the changed plist to git remote" | |
desc "- Upload build to TestFlight" | |
desc "- Upload dSYM files to Hockey" | |
desc "- Post the message on Slack" | |
lane :ps_client_itunes do |options| | |
build_number = sh("curl https://example.com/build_script.php --silent") | |
deploy_app_appstore('PSClient_AppStore', 'PSClient/PSClient.xcodeproj', options[:increament_version_number], build_number, options[:submit_for_review], "com.shopyourway.personalshopper") | |
refresh_dsyms_psclient | |
end | |
def deploy_app_appstore(scheme_name, xcodeproj_path, increament_version_number, build_number, submit_for_review, app_identifier) | |
if increament_version_number == nil | |
increament_version_number = prompt(text: "Do you want to increase the version number? Next time you can run `fastlane " + lane_context[SharedValues::LANE_NAME] + " increament_version_number:false`", ci_input: increament_version_number, boolean: true) | |
end | |
if !build_number | |
build_number = prompt(text: "Enter build number", ci_input: build_number) | |
end | |
if submit_for_review == nil | |
submit_for_review = prompt(text: "Do you want to submit for App Store review? Next time you can run `fastlane " + lane_context[SharedValues::LANE_NAME] + " submit_for_review:false`", ci_input: submit_for_review, boolean: true) | |
end | |
if increament_version_number == true | |
increment_version_number( | |
bump_type: "patch", | |
xcodeproj: xcodeproj_path | |
) | |
end | |
build_number = increment_build_number( | |
build_number: build_number, | |
xcodeproj: xcodeproj_path | |
) | |
gym({ | |
scheme: scheme_name, | |
export_method: 'app-store', | |
workspace: 'PersonalShopper.xcworkspace', | |
clean: true, | |
include_bitcode: false, | |
codesigning_identity: 'iPhone Distribution: Team Name', | |
silent: true | |
}) | |
commit_push_to_git('ps/v' + get_version_number(xcodeproj: xcodeproj_path) + "(" + build_number + ")") | |
app_description = File.read("app_description_ps.txt") | |
testflight( | |
username: '[email protected]', | |
skip_waiting_for_build_processing: false, | |
distribute_external: true, | |
wait_processing_interval: 3600, | |
beta_app_description: app_description, | |
changelog: "Change log", | |
beta_app_feedback_email: "[email protected]", | |
groups: 'External Testers' | |
) | |
if submit_for_review == true | |
deliver(force: true, submit_for_review: true, skip_binary_upload: true, skip_screenshots: true, skip_metadata: true, app_identifier: app_identifier) | |
end | |
end | |
private_lane :refresh_dsyms_psclient do | |
hockey( | |
api_token: 'YOUR_HOCKEY_API_TOKEN', | |
dsym: './PSClient.app.dSYM.zip', | |
upload_dsym_only: true, | |
public_identifier: "YOUR_HOCKEY_PUBLIC_IDENTIFIER" | |
) | |
end | |
#Commits local changes and pushes to git repository | |
def commit_push_to_git(git_tag=nil) | |
git_commit ({ | |
path: ".", | |
message: 'Build Version Bump by fastlane [ci skip]' | |
}) | |
git_pull | |
if git_tag | |
add_git_tag(tag: git_tag) | |
end | |
push_to_git_remote | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment