Skip to content

Make the release script update Gemfile.lock #1711

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

Merged
merged 3 commits into from
Mar 14, 2025
Merged

Conversation

alexeyr-ci
Copy link
Collaborator

@alexeyr-ci alexeyr-ci commented Mar 9, 2025

Summary

Update the release task post-instructions to make Gemfile.lock stable after release.

Pull Request checklist

  • [ ] Add/update test to cover these changes
  • [ ] Update documentation
  • [ ] Update CHANGELOG file

This change is Reviewable

Summary by CodeRabbit

  • Chores

    • Enhanced release messaging to clearly guide users on updating both Gemfile.lock and CHANGELOG.md after publication.
    • Introduced a reminder to run the bundle install command after publication.
    • Simplified the commit messaging for clarity.
  • New Features

    • Added a new Rake task to automate the updating of the CHANGELOG.md file, improving the documentation process for version releases.
  • Documentation

    • Added a new version entry for 15.0.0-alpha.2 in the CHANGELOG.md, including updated links for version comparisons.

Copy link
Contributor

coderabbitai bot commented Mar 9, 2025

Walkthrough

This pull request introduces several updates across multiple files to enhance the release and testing processes. The rakelib/release.rake file now includes clearer instructions regarding the updating of Gemfile.lock and the execution of bundle install after a release. A new Rake task for updating the CHANGELOG.md has been added in rakelib/update_changelog.rake, while the CHANGELOG.md file itself has been updated with a new version entry and links. Additionally, the bundle_exec method in rakelib/task_helpers.rb has been modified to ensure that bundle exec is included in command execution.

Changes

File Path Change Summary
rakelib/release.rake - Updated success message to instruct updating Gemfile.lock and CHANGELOG.md, now including bundle install.
- Simplified commit message in the task.
CHANGELOG.md - Added new version entry [15.0.0-alpha.2] - 2025-03-07.
- Updated link for [Unreleased] section to compare against 15.0.0-alpha.2.
- New link for 15.0.0-alpha.2 added for comparison with 14.2.0.
rakelib/task_helpers.rb - Modified bundle_exec method to prepend bundle exec to shell command execution.
rakelib/update_changelog.rake - Introduced new task update_changelog to automate updating CHANGELOG.md, including tag checks and date retrieval.

Suggested reviewers

  • justin808
  • Judahmeek

Poem

I'm a rabbit with hops so spry,
In code burrows, I spy a surprise.
Bundle installs and commits refined,
Gemfile.lock changes perfectly aligned.
I cheer with whiskered glee in byte-filled skies!
🐰🚀

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9bc3447 and 296e025.

📒 Files selected for processing (4)
  • CHANGELOG.md (2 hunks)
  • rakelib/release.rake (1 hunks)
  • rakelib/task_helpers.rb (1 hunks)
  • rakelib/update_changelog.rake (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • rakelib/release.rake
  • rakelib/update_changelog.rake
  • rakelib/task_helpers.rb
  • CHANGELOG.md
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: build-dummy-app-webpack-test-bundles (oldest)
  • GitHub Check: rspec-package-tests (newest)
  • GitHub Check: rspec-package-tests (oldest)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@alexeyr-ci alexeyr-ci force-pushed the alexeyr/release-script branch 2 times, most recently from 81a2b39 to b8212e1 Compare March 9, 2025 07:05
cd #{dummy_app_dir}; bundle update react_on_rails
cd #{gem_root}#{' '}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could keep it but I don't see why the space would be useful.

@alexeyr-ci alexeyr-ci requested review from justin808 and Judahmeek and removed request for Judahmeek March 9, 2025 07:07
@alexeyr-ci alexeyr-ci force-pushed the alexeyr/release-script branch from b8212e1 to cd6c3a8 Compare March 9, 2025 08:36
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
rakelib/update_changelog.rake (3)

1-3: Add frozen string literal comment

The file is missing a frozen string literal comment which would help with memory efficiency. This was flagged by both static analysis and the pipeline.

+# frozen_string_literal: true
+
 require "bundler"
 require_relative "task_helpers"
🧰 Tools
🪛 RuboCop (1.73)

[convention] 1-2: Carriage return character detected.

(Layout/EndOfLine)


[convention] 1-1: Missing frozen string literal comment.

(Style/FrozenStringLiteralComment)

🪛 GitHub Actions: Lint JS and Ruby

[warning] 1-1: Layout/EndOfLine: Carriage return character detected.


[warning] 1-1: [Correctable] Style/FrozenStringLiteralComment: Missing frozen string literal comment.


1-40: Fix line endings

The static analysis and pipeline checks detected carriage return characters in the file. Ensure consistent line endings (preferably LF) are used across the project.

# Use the following git command to normalize line endings:
git config core.autocrlf false
git rm --cached -r .
git reset --hard
🧰 Tools
🪛 RuboCop (1.73)

[convention] 1-2: Carriage return character detected.

(Layout/EndOfLine)


[convention] 1-1: Missing frozen string literal comment.

(Style/FrozenStringLiteralComment)

🪛 GitHub Actions: Lint JS and Ruby

[warning] 1-1: Layout/EndOfLine: Carriage return character detected.


[warning] 1-1: [Correctable] Style/FrozenStringLiteralComment: Missing frozen string literal comment.


19-24: Consider enhanced error handling for the Git command

The current implementation uses backticks to execute Git commands, but doesn't handle potential errors if the Git command fails. Consider adding more robust error handling.

-  tag_date = `git show -s --format=%cs #{tag}`.split("\n").last.strip
+  tag_date_output = `git show -s --format=%cs #{tag} 2>&1`
+  if $?.success?
+    tag_date = tag_date_output.split("\n").last.strip
+  else
+    puts "Failed to find the tag: #{tag_date_output}"
+    next
+  end
-  unless tag_date
-    puts "Failed to find the tag"
-    next
-  end
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b8212e1 and cd6c3a8.

⛔ Files ignored due to path filters (1)
  • Gemfile.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • CHANGELOG.md (2 hunks)
  • rakelib/release.rake (1 hunks)
  • rakelib/task_helpers.rb (1 hunks)
  • rakelib/update_changelog.rake (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • rakelib/release.rake
🧰 Additional context used
🪛 RuboCop (1.73)
rakelib/update_changelog.rake

[convention] 1-2: Carriage return character detected.

(Layout/EndOfLine)


[convention] 1-1: Missing frozen string literal comment.

(Style/FrozenStringLiteralComment)

🪛 GitHub Actions: Lint JS and Ruby
rakelib/update_changelog.rake

[warning] 1-1: Layout/EndOfLine: Carriage return character detected.


[warning] 1-1: [Correctable] Style/FrozenStringLiteralComment: Missing frozen string literal comment.

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: dummy-app-integration-tests (newest)
  • GitHub Check: dummy-app-integration-tests (oldest)
  • GitHub Check: rspec-package-tests (newest)
  • GitHub Check: rspec-package-tests (oldest)
🔇 Additional comments (4)
rakelib/task_helpers.rb (1)

47-47: Method implementation now matches its name functionality

The updated implementation now explicitly includes bundle exec in the command, which makes the method behavior consistent with its name bundle_exec. This change ensures that Ruby gems are properly executed within the bundler environment.

CHANGELOG.md (2)

21-22: New version entry added correctly

The addition of the new version entry 15.0.0-alpha.2 dated 2025-03-07 follows the project's changelog conventions.


1210-1211: Updated comparison links for version tracking

The [Unreleased] link has been correctly updated to compare the new alpha version against master, and a new link for 15.0.0-alpha.2 has been added to compare it with the previous release.

rakelib/update_changelog.rake (1)

4-39: Well-implemented changelog automation task

This new task automates the process of updating the CHANGELOG.md file during the release process. It handles:

  1. Finding the latest tag if none provided
  2. Checking if the tag is already documented
  3. Retrieving the tag date from Git
  4. Inserting the new version header
  5. Updating the comparison links

This is a valuable addition to the release process that will help maintain consistent changelog entries.

@alexeyr-ci alexeyr-ci force-pushed the alexeyr/release-script branch from cd6c3a8 to 7425e2e Compare March 9, 2025 08:51
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (5)
rakelib/update_changelog.rake (5)

14-19: Add error handling for the CHANGELOG.md file.

The script reads the CHANGELOG.md file but doesn't handle the case when the file doesn't exist. Consider adding proper error handling to make the script more robust.

-  changelog = File.read("CHANGELOG.md")
+  changelog_path = "CHANGELOG.md"
+  unless File.exist?(changelog_path)
+    puts "ERROR: #{changelog_path} does not exist!"
+    next
+  end
+  
+  changelog = File.read(changelog_path)

33-39: Extract repository URL as a constant.

The GitHub repository URL is hardcoded in multiple places. Consider extracting it to a constant at the top of the file to make it easier to maintain if the repository URL changes in the future.

  require "bundler"
  require_relative "task_helpers"
  
+ REPO_URL = "https://github.com/shakacode/react_on_rails"
  
  desc "Updates CHANGELOG.md inserting headers for the new version.

...

-  match_data = %r{https://github.com/shakacode/react_on_rails/compare/(?<prev_tag>.*)\.\.\.master}.match(changelog)
+  match_data = %r{#{REPO_URL}/compare/(?<prev_tag>.*)\.\.\.master}.match(changelog)
  if match_data
    prev_tag = match_data[:prev_tag]
-    new_unreleased_link = "https://github.com/shakacode/react_on_rails/compare/#{tag}...master"
-    new_tag_link = "#{anchor}: https://github.com/shakacode/react_on_rails/compare/#{prev_tag}...#{tag}"
+    new_unreleased_link = "#{REPO_URL}/compare/#{tag}...master"
+    new_tag_link = "#{anchor}: #{REPO_URL}/compare/#{prev_tag}...#{tag}"
    changelog.sub!(match_data[0], "#{new_unreleased_link}\n#{new_tag_link}")
  end

10-12: Validate the tag format.

The script doesn't validate the format of the tag. Consider adding a validation to ensure the tag follows a valid format (e.g., v1.0.0) to prevent unexpected behavior.

  task :update_changelog, %i[tag] do |_, args|
    tag = args[:tag] || `git describe --tags --abbrev=0`.strip
+   unless tag =~ /^v\d+\.\d+\.\d+(\.\d+|-(alpha|beta|rc)\d*)?$/
+     puts "WARNING: Tag '#{tag}' doesn't follow the expected format (vX.Y.Z, vX.Y.Z.W, or vX.Y.Z-alpha/beta/rcN)"
+   end
    anchor = "[#{tag}]"

1-42: Consider adding logging for completed actions.

The script provides feedback when a tag is already documented or when it fails to find a tag, but it doesn't inform the user when it successfully updates the changelog. Consider adding a success message to improve user experience.

  File.write("CHANGELOG.md", changelog)
+ puts "Successfully updated CHANGELOG.md with entries for #{tag}"
end
🧰 Tools
🪛 RuboCop (1.73)

[convention] 22-22: Prefer $CHILD_STATUS from the stdlib 'English' module (don't forget to require it) over $?.

(Style/SpecialGlobalVars)

🪛 GitHub Actions: Lint JS and Ruby

[warning] 22-22: [Correctable] Style/SpecialGlobalVars: Prefer $CHILD_STATUS from the stdlib 'English' module (don't forget to require it) over $?.


30-30: Consider more robust pattern matching for changelog sections.

The current approach relies on an exact match for "Changes since the last non-beta release." If this text changes, the script will fail to insert the new version header. Consider a more robust approach using regular expressions to match the section.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd6c3a8 and 7425e2e.

📒 Files selected for processing (4)
  • CHANGELOG.md (2 hunks)
  • rakelib/release.rake (1 hunks)
  • rakelib/task_helpers.rb (1 hunks)
  • rakelib/update_changelog.rake (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • rakelib/task_helpers.rb
  • rakelib/release.rake
  • CHANGELOG.md
🧰 Additional context used
🪛 RuboCop (1.73)
rakelib/update_changelog.rake

[convention] 22-22: Prefer $CHILD_STATUS from the stdlib 'English' module (don't forget to require it) over $?.

(Style/SpecialGlobalVars)

🪛 GitHub Actions: Lint JS and Ruby
rakelib/update_changelog.rake

[warning] 22-22: [Correctable] Style/SpecialGlobalVars: Prefer $CHILD_STATUS from the stdlib 'English' module (don't forget to require it) over $?.

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: rspec-package-tests (newest)
  • GitHub Check: build-dummy-app-webpack-test-bundles (oldest)
  • GitHub Check: rspec-package-tests (oldest)

@alexeyr-ci alexeyr-ci force-pushed the alexeyr/release-script branch 2 times, most recently from d6e9e36 to b3d325a Compare March 9, 2025 09:01
Argument: Git tag. Defaults to the latest tag."

task :update_changelog, %i[tag] do |_, args|
tag = args[:tag] || `git describe --tags --abbrev=0`.strip
Copy link
Collaborator Author

@alexeyr-ci alexeyr-ci Mar 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sh_in_dir is less convenient because it returns an array.

next
end

tag_date_output = `git show -s --format=%cs #{tag} 2>&1`
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexeyr-ci alexeyr-ci force-pushed the alexeyr/release-script branch 2 times, most recently from bf0cfd4 to 2c3f6bf Compare March 9, 2025 14:22
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
CHANGELOG.md (2)

18-22: Duplicate Release Section Heading

There are two identical headings for the 15.0.0‑alpha.2 release (one on line 18 and another on line 21). Duplicate headings can cause confusion when navigating the changelog and trigger markdown lint warnings (MD024). Please remove one of the duplicate headings to keep the changelog clear and compliant.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

21-21: Multiple headings with the same content
null

(MD024, no-duplicate-heading)


1210-1211: Unused Link Reference Definition

The link reference for [Unreleased]: https://github.com/shakacode/react_on_rails/compare/15.0.0-alpha.2...master appears to be defined but not used elsewhere in the document. If this reference isn’t being utilized in the changelog, consider removing it to clean up the file and adhere to markdown best practices (MD053).

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

1210-1210: Link and image reference definitions should be needed
Unused link or image reference definition: "unreleased"

(MD053, link-image-reference-definitions)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bf0cfd4 and 2c3f6bf.

📒 Files selected for processing (4)
  • CHANGELOG.md (2 hunks)
  • rakelib/release.rake (1 hunks)
  • rakelib/task_helpers.rb (1 hunks)
  • rakelib/update_changelog.rake (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • rakelib/task_helpers.rb
  • rakelib/update_changelog.rake
  • rakelib/release.rake
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
CHANGELOG.md

21-21: Multiple headings with the same content
null

(MD024, no-duplicate-heading)


1210-1210: Link and image reference definitions should be needed
Unused link or image reference definition: "unreleased"

(MD053, link-image-reference-definitions)

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: rspec-package-tests (newest)
  • GitHub Check: rspec-package-tests (oldest)
  • GitHub Check: build-dummy-app-webpack-test-bundles (oldest)
  • GitHub Check: build

@alexeyr-ci alexeyr-ci force-pushed the alexeyr/release-script branch 2 times, most recently from aae831f to 8501f35 Compare March 9, 2025 16:15
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
CHANGELOG.md (2)

1209-1210: Unused Link Reference Definition: [Unreleased]

The link reference for “[Unreleased]” is defined at line 1209 but does not appear to be used anywhere within the document. To resolve the markdownlint warning (MD053), please consider either removing this unused definition or incorporating an inline reference (for example, in the introductory sections discussing upcoming features) so that it is utilized.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

1209-1209: Link and image reference definitions should be needed
Unused link or image reference definition: "unreleased"

(MD053, link-image-reference-definitions)


1-9: Verify Alignment with Release Objectives

While the changelog accurately documents version updates and various fixes, the PR objective mentions an update to the release script to ensure that the Gemfile.lock file remains stable after a release. There is no explicit mention of this in the changelog. Please double-check that the release instructions or related documentation elsewhere include guidance regarding the handling of Gemfile.lock so that users are properly informed.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

8-8: Bare URL used
null

(MD034, no-bare-urls)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2c3f6bf and df995bb.

📒 Files selected for processing (4)
  • CHANGELOG.md (2 hunks)
  • rakelib/release.rake (1 hunks)
  • rakelib/task_helpers.rb (1 hunks)
  • rakelib/update_changelog.rake (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • rakelib/release.rake
  • rakelib/task_helpers.rb
  • rakelib/update_changelog.rake
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
CHANGELOG.md

1209-1209: Link and image reference definitions should be needed
Unused link or image reference definition: "unreleased"

(MD053, link-image-reference-definitions)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: dummy-app-integration-tests (newest)
  • GitHub Check: dummy-app-integration-tests (oldest)
🔇 Additional comments (1)
CHANGELOG.md (1)

20-21: New Version Entry for 15.0.0-alpha.2 Added

The new version header "### [15.0.0-alpha.2] - 2025-03-07" clearly documents the release date and version. Please ensure that the associated release notes (referenced by the Release Notes link) are up-to-date and in sync with this changelog entry.

@alexeyr-ci alexeyr-ci force-pushed the alexeyr/release-script branch 2 times, most recently from 42f6699 to 9bc3447 Compare March 9, 2025 16:32
@alexeyr-ci alexeyr-ci force-pushed the alexeyr/release-script branch from 9bc3447 to 296e025 Compare March 14, 2025 07:50
@justin808 justin808 merged commit a877c76 into master Mar 14, 2025
11 checks passed
@justin808 justin808 deleted the alexeyr/release-script branch March 14, 2025 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants