# Customise this file, documentation can be found here:
# https://github.com/fastlane/fastlane/tree/master/docs
# All available actions: https://github.com/fastlane/fastlane/blob/master/docs/Actions.md
# can also be listed using the `fastlane actions` command

# Change the syntax highlighting to Ruby
# All lines starting with a # are ignored when running `fastlane`

# By default, fastlane will send which actions are used
# No personal data is shared, more information on https://github.com/fastlane/enhancer
# Uncomment the following line to opt out
# opt_out_usage

# If you want to automatically update fastlane if a new version is available:
# update_fastlane

# This is the minimum version number required.
# Update this, if you use features of a newer version
fastlane_version "1.88.0"

default_platform :ios

platform :ios do
  before_all do
    
  end
  
  desc "Release new version"
  lane :release do |options|
    path = "GMPhobos.podspec"
    target_version = options[:version]
    raise "The version is missed." if target_version.nil?
    ensure_git_branch                                             # 确认 master 分支
    pod_install
    pod_lib_lint(verbose: true, allow_warnings: true, sources: ["git@git.gengmei.cc:gengmeiios/GMSpecs.git","https://github.com/CocoaPods/Specs"], use_bundle_exec: true)
    version_bump_podspec(path: path, version_number: target_version)                    # 更新 podspec
    git_commit_all(message: "Bump version to #{target_version}")  # 提交版本号修改
    add_git_tag tag: target_version                               # 设置 tag
    push_to_git_remote                                            # 推送到 git 仓库
    pod_push(path: path, repo: "GMSpecs", allow_warnings: true, sources: ["git@git.gengmei.cc:gengmeiios/GMSpecs.git","https://github.com/CocoaPods/Specs"]) # 提交到 CocoaPods                                                     
  end
	
end

# More information about multiple platforms in fastlane: https://github.com/fastlane/fastlane/blob/master/docs/Platforms.md
# All available actions: https://github.com/fastlane/fastlane/blob/master/docs/Actions.md
