Class: Fastlane::Actions::PrepareReleaseAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::PrepareReleaseAction
- Defined in:
- lib/fastlane/plugin/auth0_shipper/actions/prepare_release_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
44 45 46 |
# File 'lib/fastlane/plugin/auth0_shipper/actions/prepare_release_action.rb', line 44 def self. ["Hernan Zalazar"] end |
.available_options ⇒ Object
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 |
# File 'lib/fastlane/plugin/auth0_shipper/actions/prepare_release_action.rb', line 56 def self. [ FastlaneCore::ConfigItem.new(key: :bump, env_name: "AUTH0_SHIPPER_BUMP", description: "If the version bump is major, minor or patch", optional: true, type: String), FastlaneCore::ConfigItem.new(key: :version, env_name: "AUTH0_SHIPPER_VERSION", description: "Version of the release to perform. It ignores bump if both are supplied", optional: true, type: String), FastlaneCore::ConfigItem.new(key: :readme, env_name: "AUTH0_SHIPPER_README", description: "Path to the README file", default_value: "README.md", optional: true, type: String), FastlaneCore::ConfigItem.new(key: :changelog, env_name: "AUTH0_SHIPPER_CHANGELOG", description: "Path to the CHANGELOG file", default_value: "CHANGELOG.md", optional: true, type: String), FastlaneCore::ConfigItem.new(key: :organization, env_name: "AUTH0_SHIPPER_ORGANIZATION", description: "Github organization where the library is available", default_value: "auth0", optional: true, type: String), FastlaneCore::ConfigItem.new(key: :repository, env_name: "AUTH0_SHIPPER_REPOSITORY", description: "Github repository name where the library is available", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :xcodeproj, env_name: "AUTH0_SHIPPER_XCODEPROJ", description: "Xcode project file", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :target, env_name: "AUTH0_SHIPPER_TARGET", description: "Xcode target for the Library", optional: true, type: String), FastlaneCore::ConfigItem.new(key: :release_branch, env_name: "AUTH0_SHIPPER_RELEASE_BRANCH", description: "Name of the release branch to use", optional: true, type: String), FastlaneCore::ConfigItem.new(key: :github_token, env_name: "AUTH0_SHIPPER_GITHUB_TOKEN", description: "Github token to create Pull Request", optional: true, type: String), FastlaneCore::ConfigItem.new(key: :local_run, env_name: "AUTH0_SHIPPER_LOCAL_RUN", description: "Avoid pushing changes to remote repository", default_value: false, optional: true, type: Boolean) ] end |
.description ⇒ Object
40 41 42 |
# File 'lib/fastlane/plugin/auth0_shipper/actions/prepare_release_action.rb', line 40 def self.description "Prepares the release for an Auth0 OSS library" end |
.details ⇒ Object
52 53 54 |
# File 'lib/fastlane/plugin/auth0_shipper/actions/prepare_release_action.rb', line 52 def self.details "Preprares the release of an Auth0 OSS library (Changelog update, version bump and tag)" end |
.is_supported?(platform) ⇒ Boolean
120 121 122 |
# File 'lib/fastlane/plugin/auth0_shipper/actions/prepare_release_action.rb', line 120 def self.is_supported?(platform) [:ios].include?(platform) end |
.return_value ⇒ Object
48 49 50 |
# File 'lib/fastlane/plugin/auth0_shipper/actions/prepare_release_action.rb', line 48 def self.return_value 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 32 33 34 35 36 37 38 |
# File 'lib/fastlane/plugin/auth0_shipper/actions/prepare_release_action.rb', line 4 def self.run(params) Actions::EnsureGitStatusCleanAction.run({}) UI.user_error!("Must specify if the release is major, minor or patch or the version number") if params[:bump].nil? && params[:version].nil? current_version = Helper::Auth0ShipperHelper.resolve_current_version(params[:target]) if params[:version].nil? next_version = Helper::Auth0ShipperHelper.calculate_next_version(current_version, params[:bump]) else next_version = Helper::Auth0ShipperHelper.wrap_version params[:version] end UI.header "Preparing release for version #{next_version} 🏗" release_branch = Helper::Auth0ShipperHelper.release_branch_name(params[:release_branch], next_version) UI.user_error!("There is a local or remote branch named #{release_branch}. Please remove it or pick a different name for this release") if Helper::Auth0ShipperHelper.release_branch_exists(release_branch) UI. "Using release branch #{release_branch}" Helper::Auth0ShipperHelper.create_release_branch(release_branch) changelog_entry = Helper::Auth0ShipperHelper.prepare_changelog(current_version, next_version, params[:organization], params[:repository]) Helper::Auth0ShipperHelper.prepare_changelog_file(params[:changelog], changelog_entry) UI. "\n#{changelog_entry}" system("vim #{params[:changelog]}") unless UI.confirm("is CHANGELOG for version #{next_version} Ok?") Helper::Auth0ShipperHelper.prepare_readme_file(params[:readme], current_version, next_version) Actions::GitAddAction.run(path: [params[:readme], params[:changelog]]) Actions::IncrementVersionNumberAction.run(version_number: next_version.to_s) Actions::CommitVersionBumpAction.run(message: "Release #{next_version}", xcodeproj: params[:xcodeproj], include: [], force: true) UI.success "Release #{next_version} ready to be uploaded! 📦" Actions::PushToGitRemoteAction.run({remote: 'origin', local_branch: release_branch}) unless params[:local_run] Actions::CreatePullRequestAction.run({ api_token: params[:github_token], repo: "#{params[:organization]}/#{params[:repository]}", head: release_branch, base: 'master', title: "Release #{next_version}", body: changelog_entry, api_url: 'https://api.github.com' }) unless params[:local_run] || params[:github_token].nil? next_version end |