-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5049127
commit fa3b0c0
Showing
3 changed files
with
99 additions
and
1 deletion.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
lib/fastlane/plugin/stream_actions/actions/merge_main_to_develop.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module Fastlane | ||
module Actions | ||
class MergeMainToDevelopAction < Action | ||
def self.run(params) | ||
other_action.ensure_git_status_clean | ||
sh('git checkout main') | ||
sh('git pull origin main') | ||
sh('git checkout origin/develop') | ||
sh('git pull origin develop') | ||
sh('git log develop..main') | ||
sh('git merge main') | ||
sh('git push origin develop') | ||
end | ||
|
||
##################################################### | ||
# @!group Documentation | ||
##################################################### | ||
|
||
def self.description | ||
'Merge main branch to develop' | ||
end | ||
|
||
def self.available_options | ||
[] | ||
end | ||
|
||
def self.is_supported?(platform) | ||
true | ||
end | ||
end | ||
end | ||
end |
66 changes: 66 additions & 0 deletions
66
lib/fastlane/plugin/stream_actions/actions/merge_release_to_main.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
module Fastlane | ||
module Actions | ||
class MergeReleaseToMainAction < Action | ||
def self.run(params) | ||
other_action.ensure_git_status_clean | ||
|
||
release_branch = | ||
if is_ci | ||
# This API operation needs the "admin:org" scope. | ||
ios_team = `gh api orgs/GetStream/teams/#{params[:github_team_name]}/members -q '.[].login'`.split("\n") | ||
UI.user_error!("#{params[:author]} is not a member of the iOS Team") unless ios_team.include?(params[:author]) | ||
|
||
other_action.current_branch | ||
else | ||
release_branches = sh(command: 'git branch -a').delete(' ').split("\n").grep(%r(origin/.*release/)) | ||
UI.user_error!("Expected 1 release branch, found #{release_branches.size}") if release_branches.size != 1 | ||
|
||
release_branches.first | ||
end | ||
|
||
UI.user_error!("`#{release_branch}`` branch does not match the release branch pattern: `release/*`") unless release_branch.start_with?('release/') | ||
|
||
sh('git config pull.ff only') | ||
sh('git fetch --all --tags --prune') | ||
sh("git checkout #{release_branch}") | ||
sh("git pull origin #{release_branch} --ff-only") | ||
sh('git checkout main') | ||
sh('git pull origin main --ff-only') | ||
sh("git merge #{release_branch} --ff-only") | ||
sh('git push origin main') | ||
|
||
comment = "Publication of the release has been launched 👍" | ||
UI.important(comment) | ||
other_action.pr_comment(text: comment) | ||
end | ||
|
||
##################################################### | ||
# @!group Documentation | ||
##################################################### | ||
|
||
def self.description | ||
'Merge release branch to main' | ||
end | ||
|
||
def self.available_options | ||
[ | ||
FastlaneCore::ConfigItem.new( | ||
env_name: 'USER_LOGIN', | ||
key: :author, | ||
description: 'Github user name', | ||
optional: true | ||
), | ||
FastlaneCore::ConfigItem.new( | ||
key: :github_team_name, | ||
description: 'Github team name', | ||
default_value: 'ios-developers' | ||
) | ||
] | ||
end | ||
|
||
def self.is_supported?(platform) | ||
true | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module Fastlane | ||
module StreamActions | ||
VERSION = '0.3.60' | ||
VERSION = '0.3.61' | ||
end | ||
end |