# This file contains the fastlane.tools configuration # You can find the documentation at https://docs.fastlane.tools # # For a list of all available actions, check out # # https://docs.fastlane.tools/actions # # For a list of all available plugins, check out # # https://docs.fastlane.tools/plugins/available-plugins # # Uncomment the line if you want fastlane to automatically update itself # update_fastlane fastlane_require "dotenv" fastlane_require "fileutils" load "xcconfig.rb" Dotenv.load ".env.secret" setup_ci if ENV["CI"] xcconfig = ENV["XCCONFIG_PATH"] api = ENV["API_PACKAGE_PATH"] metadata = "fastlane/metadata" logname = "CHANGELOG.txt" build_path = "build" derived_data_path = "build/derived_data" desc "Bump version" lane :bump do |options| unless options[:no_log] if options[:since] between = [options[:since], "HEAD"] else between = nil end log = changelog_from_git_commits( between: between, pretty: "* %s", date_format: "short" ) path = "../#{logname}" path_tmp = "#{path}.tmp" File.open(path_tmp, "w") { |file| file.write(log) } if system("vim", path_tmp) FileUtils.mv(path_tmp, path) else File.delete(path_tmp) UI.user_error!("CHANGELOG editor cancelled") end end build = options[:build] version = options[:version] if build.nil? || build.empty? build = xcconfig_get("../#{xcconfig}", "CURRENT_PROJECT_VERSION").to_i + 1 end xcconfig_set("../#{xcconfig}", "CURRENT_PROJECT_VERSION", build) unless version.nil? || version.empty? xcconfig_set("../#{xcconfig}", "MARKETING_VERSION", version) end system("../scripts/copy-release-notes.sh") git_commit( path: [ xcconfig, api, metadata, logname ], message: "Bump version" ) unless options[:no_tag] add_git_tag( includes_lane: false, sign: true, build_number: build ) end end desc "Run Xcode tests" lane :test do scan( xcargs: "CODE_SIGNING_ALLOWED=NO", derived_data_path: derived_data_path ) end desc "Push a new beta build to TestFlight" lane :beta do preface = ENV["TESTFLIGHT_PREFACE"] log = File.read("../#{logname}") changelog = preface + log match(type: "appstore") gym( clean: true, build_path: build_path, derived_data_path: derived_data_path ) pilot( changelog: changelog, distribute_external: true, notify_external_testers: false ) end desc "Distribute to Public Beta" lane :public_beta do pilot( distribute_only: true, distribute_external: true, notify_external_testers: true ) end desc "Update App Store metadata" lane :asc_metadata do deliver( skip_metadata: false, skip_screenshots: true ) end desc "Update App Store screenshots" lane :asc_screenshots do deliver( skip_metadata: true, skip_screenshots: false ) end desc "Submit a build to App Review" lane :asc_review do |options| deliver( submit_for_review: true, skip_binary_upload: true, skip_metadata: false, skip_screenshots: false, submission_information: { add_id_info_uses_idfa: false, export_compliance_uses_encryption: false } ) end desc "Tag release" lane :tag_release do |options| version = options[:version] tag = "v#{version}" add_git_tag( tag: tag, sign: true ) push_git_tags( tag: tag ) end