Skip to content

Commit

Permalink
Merge pull request #836 from bugsnag/dep-update/simplify
Browse files Browse the repository at this point in the history
Use built-in command for bumpsnag updates
  • Loading branch information
twometresteve authored Oct 9, 2024
2 parents d61a035 + afbd3e0 commit 1d5a78e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 45 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/update-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Install dependencies
run: bundle install

- run: bundle exec rake dependencies:update
- run: bundle exec bumpsnag update-submodule $TARGET_SUBMODULE $TARGET_VERSION

- name: List current branch name
id: current-branch
Expand Down
44 changes: 0 additions & 44 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ require 'fileutils'
require 'tmpdir'
require "json"

unless ENV['GITHUB_ACTIONS'].nil?
require "bumpsnag"
end

HOST_OS = RbConfig::CONFIG['host_os']
def is_mac?; HOST_OS =~ /darwin/i; end
def is_windows?; HOST_OS =~ /mingw|mswin|windows/i; end
Expand Down Expand Up @@ -705,43 +701,3 @@ namespace :test do
end
end
end

namespace :dependencies do
task :update do
target_submodule = ENV['TARGET_SUBMODULE']
target_version = ENV['TARGET_VERSION']

if target_submodule.nil? || target_version.nil?
raise 'Submodule or version targets not provided, exiting'
exit(1)
end

pp "Updating submodule: #{target_submodule} to version: #{target_version}"
updated = Bumpsnag.update_submodule(target_submodule, target_version)

if updated
local_info = Bumpsnag.get_git_info
target_info = Bumpsnag.get_git_info(target_submodule)

target_pr = local_info[:latest_pr] + 1
origin_repo = 'https://github.com/bugsnag/bugsnag-unity'
target_repo = target_info[:origin]

changelog_message = "Update #{target_submodule} to [#{target_version}](#{target_repo}/releases/tag/#{target_version}) [##{target_pr}](#{origin_repo}/pull/#{target_pr})"

Bumpsnag.add_changelog_entry(changelog_message, 'Dependencies')

release_branch = "bumpsnag-#{target_submodule}-#{target_version}"

commit_message = "Update #{target_submodule} to #{target_version} [full ci]"

Bumpsnag.change_branch(release_branch, true)
Bumpsnag.commit_changes(commit_message, [target_submodule, 'CHANGELOG.md'])
Bumpsnag.push_changes(release_branch)

pp 'Update complete'
else
pp "Nothing was updated"
end
end
end

0 comments on commit 1d5a78e

Please sign in to comment.