Skip to content

Commit

Permalink
Merge pull request rails#53349 from jhawthorn/releaser_improvements
Browse files Browse the repository at this point in the history
Small improvements to releaser
  • Loading branch information
jhawthorn authored Oct 24, 2024
2 parents 44df566 + 02c2c5d commit a801911
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions tools/releaser/lib/releaser.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require "json"
require "digest"
require "rake/tasklib"

class Releaser < Rake::TaskLib
Expand Down Expand Up @@ -114,6 +115,18 @@ def define
desc "Build gem files for all projects"
task build: FRAMEWORKS.map { |f| "#{f}:build" } + ["rails:build"]

task checksums: :build do
Dir.chdir(root) do
puts
[*FRAMEWORKS, "rails"].each do |fw|
path = gem_path(fw)
sha = ::Digest::SHA256.file(path)
puts "#{sha} #{path}"
end
puts
end
end

task :bundle do
sh "bundle check"
end
Expand All @@ -127,6 +140,10 @@ def define
raise "GitHub CLI is not logged in. Please run `gh auth login` to log in."
end
end
default_repo = `git config --local --get-regexp '\.gh-resolved$'`.strip
if !$?.success? || default_repo.empty?
raise "GitHub CLI does not have a default repo configured. Please run `gh repo set-default rails/rails`"
end
end

task :commit do
Expand Down Expand Up @@ -155,15 +172,17 @@ def define
Dir.chdir(root) do
File.write("pkg/#{version}.md", release_notes)

sh "gh release create #{tag} -t #{version} -F pkg/#{version}.md --draft#{pre_release? ? " --prerelease" : ""}"
sh "gh release create --verify-tag #{tag} -t #{version} -F pkg/#{version}.md --draft#{pre_release? ? " --prerelease" : ""}"
end
end

desc "Release all gems and create a tag"
task release: %w(check_gh_client prep_release commit tag create_release)

task pre_push: [:build, :checksums]

desc "Push the gem to rubygems.org and the npm package to npmjs.com"
task push: FRAMEWORKS.map { |f| "#{f}:push" } + ["rails:push"]
task push: [:pre_push] + FRAMEWORKS.map { |f| "#{f}:push" } + ["rails:push"]
end

def pre_release?
Expand Down

0 comments on commit a801911

Please sign in to comment.