Fastfile 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. fastlane_version "1.37.0"
  2. default_platform :ios
  3. platform :ios do
  4. desc "Runs all the tests"
  5. lane :tests do
  6. test(scheme: "Kingfisher", swift_version: "5.0")
  7. test(scheme: "Kingfisher-macOS", swift_version: "5.0")
  8. test(scheme: "Kingfisher-tvOS", swift_version: "5.0")
  9. test(scheme: "Kingfisher", swift_version: "4.2")
  10. test(scheme: "Kingfisher-macOS", swift_version: "4.2")
  11. test(scheme: "Kingfisher-tvOS", swift_version: "4.2")
  12. test(scheme: "Kingfisher", swift_version: "4.0")
  13. test(scheme: "Kingfisher-macOS", swift_version: "4.0")
  14. test(scheme: "Kingfisher-tvOS", swift_version: "4.0")
  15. end
  16. lane :test do |options|
  17. _test(options)
  18. end
  19. private_lane :_test do |options|
  20. if options[:scheme].include? "macOS"
  21. scan(scheme: options[:scheme], clean: true, xcargs: "SWIFT_VERSION=#{options[:swift_version]}", destination: "platform=macOS")
  22. else
  23. scan(scheme: options[:scheme], clean: true, xcargs: "SWIFT_VERSION=#{options[:swift_version]}")
  24. end
  25. end
  26. lane :test_ci do
  27. test(scheme: ENV["SCHEME"], swift_version: ENV["SWIFT_VERSION"])
  28. end
  29. desc "Lint"
  30. lane :lint do
  31. carthage(command: "build", no_skip_current: true)
  32. pod_lib_lint
  33. end
  34. desc "Release new version"
  35. lane :release do |options|
  36. target_version = options[:version]
  37. raise "The version is missed. Use `fastlane release version:{version_number}`.`" if target_version.nil?
  38. ensure_git_branch
  39. ensure_git_status_clean
  40. tests
  41. lint
  42. carthage(command: "archive", frameworks: ["Kingfisher"])
  43. sync_build_number_to_git
  44. increment_version_number(version_number: target_version)
  45. version_bump_podspec(path: "Kingfisher.podspec", version_number: target_version)
  46. log = extract_current_change_log(version: target_version)
  47. release_log = update_change_log(log: log)
  48. doc(version: target_version)
  49. git_commit_all(message: "Bump version to #{target_version}")
  50. Actions.sh("git tag -s #{target_version} -m ''")
  51. push_to_git_remote
  52. set_github_release(
  53. repository_name: "onevcat/Kingfisher",
  54. api_token: ENV['GITHUB_TOKEN'],
  55. name: release_log[:title],
  56. tag_name: target_version,
  57. description: release_log[:text],
  58. upload_assets: ["Kingfisher.framework.zip"]
  59. )
  60. pod_push
  61. end
  62. lane :podpush do
  63. pod_push
  64. end
  65. lane :doc do |options|
  66. target_version = options[:version]
  67. Actions.sh("cd .. && jazzy \
  68. --clean \
  69. --author \"Wei Wang\" \
  70. --author_url https://onevcat.com \
  71. --github_url https://github.com/onevcat/Kingfisher \
  72. --github-file-prefix https://github.com/onevcat/Kingfisher/tree/#{target_version} \
  73. --module-version #{target_version} \
  74. --module Kingfisher \
  75. --root-url http://onevcat.github.io/Kingfisher/ \
  76. --output docs/ \
  77. --theme fullwidth")
  78. end
  79. after_all do |lane|
  80. end
  81. error do |lane, exception|
  82. end
  83. end