Skip to content

Commit 604b823

Browse files
Add skip_push option to release task
- Add 4th argument 'skip_push' to skip git push operations - Useful for testing the release process locally - Commits and tags are still created, but not pushed to remote - Displays warning message when push is skipped - Update documentation with new parameter and example usage Example: rake release[16.2.0,false,npm,skip_push] 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent ffc8950 commit 604b823

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

rakelib/release.rake

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,15 @@ This task depends on the gem-release ruby gem which is installed via `bundle ins
2929
2nd argument: Perform a dry run by passing 'true' as a second argument.
3030
3rd argument: Use Verdaccio local registry by passing 'verdaccio' as a third argument.
3131
Requires Verdaccio server running on http://localhost:4873/
32+
4th argument: Skip pushing to remote by passing 'skip_push' as a fourth argument.
33+
Useful for testing the release process locally.
3234
3335
Examples:
34-
rake release[16.2.0] # Release to production
35-
rake release[16.2.0,true] # Dry run
36-
rake release[16.2.0,false,verdaccio] # Test release to Verdaccio")
37-
task :release, %i[gem_version dry_run registry] do |_t, args|
36+
rake release[16.2.0] # Release to production
37+
rake release[16.2.0,true] # Dry run
38+
rake release[16.2.0,false,verdaccio] # Test release to Verdaccio
39+
rake release[16.2.0,false,npm,skip_push] # Release without pushing to remote")
40+
task :release, %i[gem_version dry_run registry skip_push] do |_t, args|
3841
include ReactOnRails::TaskHelpers
3942

4043
# Check if there are uncommitted changes
@@ -43,6 +46,7 @@ task :release, %i[gem_version dry_run registry] do |_t, args|
4346

4447
is_dry_run = ReactOnRails::Utils.object_to_boolean(args_hash[:dry_run])
4548
use_verdaccio = args_hash.fetch(:registry, "") == "verdaccio"
49+
skip_push = args_hash.fetch(:skip_push, "") == "skip_push"
4650

4751
gem_version = args_hash.fetch(:gem_version, "")
4852

@@ -117,8 +121,10 @@ task :release, %i[gem_version dry_run registry] do |_t, args|
117121
sh_in_dir(gem_root, "git tag v#{actual_gem_version}")
118122

119123
# Push commits and tags
120-
sh_in_dir(gem_root, "git push")
121-
sh_in_dir(gem_root, "git push --tags")
124+
unless skip_push
125+
sh_in_dir(gem_root, "git push")
126+
sh_in_dir(gem_root, "git push --tags")
127+
end
122128

123129
puts "\n#{'=' * 80}"
124130
puts "Publishing NPM packages to #{use_verdaccio ? 'Verdaccio (local)' : 'npmjs.org'}..."
@@ -183,6 +189,16 @@ task :release, %i[gem_version dry_run registry] do |_t, args|
183189

184190
msg += " - react_on_rails #{actual_gem_version} (RubyGems)\n" unless use_verdaccio
185191

192+
if skip_push
193+
msg += <<~SKIP_PUSH
194+
195+
⚠️ Git push was skipped. Don't forget to push manually:
196+
git push
197+
git push --tags
198+
199+
SKIP_PUSH
200+
end
201+
186202
if use_verdaccio
187203
msg += <<~VERDACCIO
188204

0 commit comments

Comments
 (0)