-
-
Notifications
You must be signed in to change notification settings - Fork 62
Fix release task to commit version bump before gem release (#???) #195
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,11 +40,32 @@ task :release, %i[gem_version dry_run] do |_t, args| | |
|
||
# See https://github.com/svenfuchs/gem-release | ||
sh_in_dir(gem_root, "git pull --rebase") | ||
sh_in_dir(gem_root, "gem bump --no-commit --file lib/cypress_on_rails/version.rb #{gem_version.strip.empty? ? '' : %(-v #{gem_version})}") | ||
sh_in_dir(gem_root, "gem bump --no-commit --file lib/cypress_on_rails/version.rb #{gem_version.strip.empty? ? '' : %(--version #{gem_version})}") | ||
|
||
# Release the new gem version | ||
puts "Carefully add your OTP for Rubygems. If you get an error, run 'gem release' again." | ||
sh_in_dir(gem_root, "gem release") unless is_dry_run | ||
# Read the actual version from the file after bump | ||
load File.expand_path("../lib/cypress_on_rails/version.rb", __dir__) | ||
actual_version = CypressOnRails::VERSION | ||
|
||
# Update Gemfile.lock files | ||
sh_in_dir(gem_root, "bundle install") | ||
|
||
unless is_dry_run | ||
# Commit the version bump and Gemfile.lock update | ||
sh_in_dir(gem_root, "git add lib/cypress_on_rails/version.rb Gemfile.lock") | ||
sh_in_dir(gem_root, "git commit -m \"Release v#{actual_version}\"") | ||
|
||
# Tag the release | ||
sh_in_dir(gem_root, "git tag v#{actual_version}") | ||
|
||
# Push the commit and tag | ||
sh_in_dir(gem_root, "git push && git push --tags") | ||
|
||
# Release the new gem version | ||
puts "Carefully add your OTP for Rubygems. If you get an error, run 'gem release' again." | ||
sh_in_dir(gem_root, "gem release") | ||
else | ||
puts "DRY RUN: Would have committed, tagged v#{actual_version}, pushed, and released gem" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❓ Verification inconclusiveDry-run message will fail after fixing the workspace modification issue. After addressing the critical dry-run issue (moving bump/install inside the conditional), After applying the fix for line 43, you'll need to determine the version for the dry-run message. Consider one of these approaches:
else
# For dry-run, calculate what the version would be
require_relative "../lib/cypress_on_rails/version"
current_version = CypressOnRails::VERSION
if gem_version.strip.empty?
# Calculate patch bump
parts = current_version.split('.')
parts[-1] = (parts[-1].to_i + 1).to_s
next_version = parts.join('.')
else
next_version = gem_version
end
puts "DRY RUN: Would have committed, tagged v#{next_version}, pushed, and released gem"
end
else
output = `cd #{gem_root} && gem bump --pretend --file lib/cypress_on_rails/version.rb #{gem_version.strip.empty? ? '' : %(--version #{gem_version})}`
# Parse output to get version
puts "DRY RUN: Would have committed, tagged v<version>, pushed, and released gem"
end Run this script to check if 🏁 Script executed: #!/bin/bash
gem bump --help | grep -E '(pretend|dry.?run|simulate)' -i Length of output: 83 Handle undefined After moving the bump/install into the production path, else
require_relative "../lib/cypress_on_rails/version"
current_version = CypressOnRails::VERSION
gem_version_strip = gem_version.strip
next_version = if gem_version_strip.empty?
parts = current_version.split('.')
parts[-1] = (parts[-1].to_i + 1).to_s
parts.join('.')
else
gem_version_strip
end
puts "DRY RUN: Would have committed, tagged v#{next_version}, pushed, and released gem"
end 🤖 Prompt for AI Agents
|
||
end | ||
|
||
msg = <<~MSG | ||
Once you have successfully published, run these commands to update CHANGELOG.md: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In dry-run mode the task still performs gem bump and bundle install earlier (modifying version.rb and Gemfile.lock), leaving a dirty workspace despite messaging that implies only hypothetical actions. Consider wrapping the bump and bundle install in the same unless is_dry_run block (or revert changes after) so a dry run does not alter the working tree.
Copilot uses AI. Check for mistakes.