Skip to content

Commit

Permalink
Add more actions
Browse files Browse the repository at this point in the history
  • Loading branch information
testableapple committed Aug 16, 2024
1 parent 5049127 commit fa3b0c0
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 1 deletion.
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
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
2 changes: 1 addition & 1 deletion lib/fastlane/plugin/stream_actions/version.rb
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

0 comments on commit fa3b0c0

Please sign in to comment.