Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up release automation #1424

Merged
merged 3 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions .github/scripts/release-workflow-package-push.sh

This file was deleted.

94 changes: 0 additions & 94 deletions .github/scripts/release-workflow-prepare-pr.sh

This file was deleted.

40 changes: 1 addition & 39 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ require 'hatchet/tasks'
ENV["BUILDPACK_LOG_FILE"] ||= "tmp/buildpack.log"

require_relative 'lib/rake/deploy_check'
require_relative 'lib/rake/tarballer'

S3_BUCKET_REGION = "us-east-1"
S3_BUCKET_NAME = "heroku-buildpack-ruby"
Expand Down Expand Up @@ -68,39 +67,7 @@ end
namespace :buildpack do
desc "prepares the next version of the buildpack for release"
task :prepare do
deploy = DeployCheck.new(github: "heroku/heroku-buildpack-ruby")
unreleased_changelogs = Pathname(__dir__).join("changelogs/unreleased").glob("*.md")
if unreleased_changelogs.empty?
puts "No devcenter changelog entries on disk in changelogs/unreleased"
else
next_changelog_dir = Pathname(__dir__).join("changelogs").join(deploy.next_version.to_s)

next_changelog_dir.mkpath

unreleased_changelogs.each do |source|
dest = next_changelog_dir.join(source.basename)
puts "Moving #{source} to #{dest}"
FileUtils.mv(source, dest)
end
end

changelog_md = Pathname(__dir__).join("CHANGELOG.md")
contents = changelog_md.read
version_string = "## #{deploy.next_version}"
if contents.include?(version_string)
puts "Found an entry in CHANGELOG.md for #{version_string}"
else
new_section = "## Main (unreleased)\n\n#{version_string} (#{Time.now.strftime("%Y/%m/%d")})"

puts "Writing to CHANGELOG.md:\n\n#{new_section}"

changelog_md.write(contents.gsub("## Main (unreleased)", new_section))
end

version_rb = Pathname(__dir__).join("lib/language_pack/version.rb")
puts "Updating version.rb"
contents = version_rb.read.gsub(/BUILDPACK_VERSION = .*$/, %Q{BUILDPACK_VERSION = "#{deploy.next_version.to_s}"})
version_rb.write(contents)
puts("Use https://github.com/heroku/heroku-buildpack-ruby/actions/workflows/prepare-release.yml")
end

desc "releases the next version of the buildpack"
Expand All @@ -122,11 +89,6 @@ namespace :buildpack do
puts "Releasing to heroku: `#{command}`"
exec(command)
end
desc "stage a tarball of the buildpack, this runs on github actions to deploy CNB"
task :tarball do
tarballer = Tarballer.new(name: "heroku-buildpack-ruby", directory: __dir__)
tarballer.call
end
end

desc "update plugins"
Expand Down
4 changes: 2 additions & 2 deletions lib/rake/deploy_check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ def check_branch!(name = "main")

# Raises an error if the changelog does not have an entry with the designated version
def check_changelog!
if !File.read("CHANGELOG.md").include?("## #{next_version}")
raise "Expected CHANGELOG.md to include #{next_version} but it did not"
if !File.read("CHANGELOG.md").include?("## [#{next_version}]")
raise "Expected CHANGELOG.md to include [#{next_version}] but it did not"
end
end

Expand Down
52 changes: 0 additions & 52 deletions lib/rake/tarballer.rb

This file was deleted.

4 changes: 2 additions & 2 deletions spec/rake/deploy_check_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ def deploy.remote_tag_array; [ "v123" ] ; end
run!("touch CHANGELOG.md")
expect {
deploy.check_changelog!
}.to raise_error(/Expected CHANGELOG.md to include v999/)
}.to raise_error(/Expected CHANGELOG.md to include \[v999\]/)

run!("echo '## v999' >> CHANGELOG.md")
run!("echo '## [v999]' >> CHANGELOG.md")
deploy.check_changelog!
end
end
Expand Down
30 changes: 0 additions & 30 deletions spec/rake/tarballer_spec.rb

This file was deleted.