From 18d85fd2ba899fce5e127c76d1df9907e5690d40 Mon Sep 17 00:00:00 2001 From: nmburgan <13688219+nmburgan@users.noreply.github.com> Date: Wed, 14 Oct 2026 20:13:32 +0000 Subject: [PATCH] Add the Prepare Release workflow It sets the version in project.clj, generates CHANGELOG.md and opens the pull request to merge before running Release. The Gemfile and the rake tasks give the shared workflow the version bump and the release:prepare task it expects. Signed-off-by: nmburgan <13688219+nmburgan@users.noreply.github.com> Assisted-by: Claude Fable 5.1 --- .github/workflows/prepare_release.yml | 30 +++++++++++++++++ Gemfile | 8 +++++ Rakefile | 46 +++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 .github/workflows/prepare_release.yml create mode 100644 Gemfile create mode 100644 Rakefile diff --git a/.github/workflows/prepare_release.yml b/.github/workflows/prepare_release.yml new file mode 100644 index 00000000..d019448e --- /dev/null +++ b/.github/workflows/prepare_release.yml @@ -0,0 +1,30 @@ +--- +name: 'Prepare Release' + +on: + workflow_dispatch: + inputs: + version: + description: 'Version to be released (e.g., 7.0.5)' + required: true + type: string + branch: + description: 'The branch to release from. 5.x is for OpenVox 8. 6.x is JRuby 10.0 and currently not used' + type: choice + options: + - main + - '5.x' + - '6.x' + default: 'main' + +permissions: {} + +jobs: + prepare_release: + uses: 'openvoxproject/shared-actions/.github/workflows/prepare_release.yml@main' + with: + version: ${{ inputs.version }} + base-branch: ${{ inputs.branch }} + secrets: + github_pat: ${{ secrets.OPENVOXBOT_COMMIT_AND_PRS }} + ssh_private_key: ${{ secrets.OPENVOXBOT_SSH_PRIVATE_KEY }} diff --git a/Gemfile b/Gemfile new file mode 100644 index 00000000..e363f8d3 --- /dev/null +++ b/Gemfile @@ -0,0 +1,8 @@ +source ENV['GEM_SOURCE'] || 'https://rubygems.org' + +gem 'rake' + +group :release, optional: true do + gem 'faraday-retry', '~> 2.1', require: false + gem 'github_changelog_generator', '~> 1.18', require: false +end diff --git a/Rakefile b/Rakefile new file mode 100644 index 00000000..b9610cad --- /dev/null +++ b/Rakefile @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +begin + require 'github_changelog_generator/task' +rescue LoadError + task :changelog do + abort('Run `bundle install --with release` to install the `github_changelog_generator` gem.') + end +else + GitHubChangelogGenerator::RakeTask.new :changelog do |config| + config.header = <<~HEADER.chomp + # Changelog + + All notable changes to this project will be documented in this file. + HEADER + config.user = 'OpenVoxProject' + config.project = 'jruby-utils' + config.exclude_labels = %w[dependencies duplicate question invalid wontfix wont-fix modulesync skip-changelog] + config.future_release = File.readlines('project.clj') + .grep(/^\(defproject /).first[/"([^"]+)"/, 1] + .sub(/-SNAPSHOT\z/, '') + # The generated changelog starts with 5.2.1, the first release after the move to OpenVoxProject. + # Only tags on main count, so releases from the 5.x and 6.x branches stay out. + config.since_tag = '4.2.0' + config.include_tags_regex = /\A4\.2\.0\z|\A5\.[2-4]\.|\A5\.5\.0\z|\A6\.0\.0\z|\A7\./ + config.release_branch = 'main' + end +end + +namespace :vox do + desc 'Set the version in project.clj for the release' + task 'version:bump:full', [:version] do |_, args| + version = args[:version] + abort 'You must provide a version.' if version.nil? || version.empty? + + project = File.read('project.clj') + defproject = /^(\(defproject\s+\S+\s+)"[^"]+"/ + abort 'Could not find the defproject version in project.clj' unless project.match?(defproject) + + File.write('project.clj', project.sub(defproject) { "#{Regexp.last_match(1)}\"#{version}\"" }) + puts "Set the version in project.clj to #{version}" + end +end + +desc 'Prepare for a release' +task 'release:prepare' => [:changelog]