Class: Fastlane::Actions::PublishIosSdkAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/stream_actions/actions/publish_ios_sdk.rb

Documentation collapse

Class Method Summary collapse

Class Method Details

.available_optionsObject



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/fastlane/plugin/stream_actions/actions/publish_ios_sdk.rb', line 54

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :version,
      description: 'Release version (not required if release type is set)'
    ),
    FastlaneCore::ConfigItem.new(
      key: :sdk_names,
      description: 'SDK names to release',
      is_string: false,
      verify_block: proc do |sdks|
        UI.user_error!("SDK names array has to be specified") unless sdks.kind_of?(Array) && sdks.size.positive?
      end
    ),
    FastlaneCore::ConfigItem.new(
      key: :skip_pods,
      description: 'Skip release to CocoaPods?',
      is_string: false,
      optional: true,
      default_value: false
    ),
    FastlaneCore::ConfigItem.new(
      key: :podspec_names,
      description: 'Podspec names to release',
      is_string: false,
      optional: true
    ),
    FastlaneCore::ConfigItem.new(
      env_name: 'GITHUB_REPOSITORY',
      key: :github_repo,
      description: 'Github repository name'
    ),
    FastlaneCore::ConfigItem.new(
      env_name: 'GITHUB_TOKEN',
      key: :github_token,
      description: 'GITHUB_TOKEN environment variable'
    ),
    FastlaneCore::ConfigItem.new(
      key: :skip_branch_check,
      description: 'Skip branch check',
      is_string: false,
      optional: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :skip_git_status_check,
      description: 'Skip git status check',
      is_string: false,
      optional: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :changelog_path,
      env_name: 'FL_CHANGELOG_PATH',
      description: 'The path to your project CHANGELOG.md',
      is_string: true,
      default_value: './CHANGELOG.md'
    ),
    FastlaneCore::ConfigItem.new(
      key: :changelog,
      description: 'Static changelog',
      is_string: true,
      optional: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :upload_assets,
      description: 'Path to assets to be uploaded with the release',
      is_string: false,
      optional: true
    )
  ]
end

.descriptionObject



50
51
52
# File 'lib/fastlane/plugin/stream_actions/actions/publish_ios_sdk.rb', line 50

def self.description
  'Publish iOS SDKs'
end

.ensure_everything_is_set_up(params) ⇒ Object



33
34
35
36
# File 'lib/fastlane/plugin/stream_actions/actions/publish_ios_sdk.rb', line 33

def self.ensure_everything_is_set_up(params)
  other_action.ensure_git_branch(branch: 'main') unless params[:skip_branch_check]
  other_action.ensure_git_status_clean unless params[:skip_git_status_check]
end

.ensure_release_tag_is_new(version_number) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/fastlane/plugin/stream_actions/actions/publish_ios_sdk.rb', line 38

def self.ensure_release_tag_is_new(version_number)
  if other_action.git_tag_exists(tag: version_number)
    UI.user_error!("Tag for version #{version_number} already exists!")
  else
    UI.success("Ignore the red warning above. Tag for version #{version_number} is alright!")
  end
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


125
126
127
# File 'lib/fastlane/plugin/stream_actions/actions/publish_ios_sdk.rb', line 125

def self.is_supported?(platform)
  [:ios].include?(platform)
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fastlane/plugin/stream_actions/actions/publish_ios_sdk.rb', line 4

def self.run(params)
  version_number = params[:version]

  ensure_everything_is_set_up(params)
  ensure_release_tag_is_new(version_number)

  changes = params[:changelog] || other_action.read_changelog(version: version_number, changelog_path: params[:changelog_path])

  release_details = other_action.set_github_release(
    repository_name: params[:github_repo],
    api_token: params[:github_token],
    name: version_number,
    tag_name: version_number,
    description: changes,
    commitish: other_action.current_branch,
    upload_assets: params[:upload_assets]
  )

  unless params[:skip_pods]
    podspecs = []
    (params[:podspec_names] || params[:sdk_names]).each do |sdk|
      podspecs << (sdk.include?('.podspec') ? sdk : "#{sdk}.podspec")
    end
    podspecs.each { |podspec| other_action.pod_push_safely(podspec: podspec) }
  end

  UI.success("Github release v#{version_number} was created, please visit #{release_details['html_url']} to see it! 🚢")
end