Skip to content
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
194 changes: 151 additions & 43 deletions docs/contributor-info/releasing.md
Original file line number Diff line number Diff line change
@@ -1,77 +1,185 @@
# Install and Release

We're now releasing this as a combined ruby gem plus npm package. We will keep the version numbers in sync.
We're releasing this as a combined Ruby gem plus two NPM packages. We keep the version numbers in sync across all packages.

## Testing the Gem before Release from a Rails App

See [Contributing](https://github.com/shakacode/react_on_rails/tree/master/CONTRIBUTING.md)

## Releasing a new gem version
## Releasing a New Version

Run `rake -D release` to see instructions on how to release via the rake task.

As of 01-26-2016, this would give you an output like this:
### Release Command

```bash
rake release[gem_version,dry_run]
```
rake release[gem_version,dry_run,tools_install]
Releases both the gem and node package using the given version.

IMPORTANT: the gem version must be in valid rubygem format (no dashes).
It will be automatically converted to a valid npm semver by the rake task
for the node package version. This only makes a difference for pre-release
versions such as `3.0.0.beta.1` (npm version would be `3.0.0-beta.1`).
**Arguments:**

This task will also globally install gem-release (ruby gem) and
release-it (node package) unless you specify skip installing tools.
- `gem_version`: The new version in rubygem format (no dashes). Pass no argument to automatically perform a patch version bump.
- `dry_run`: Optional. Pass `true` to see what would happen without actually releasing.

2nd argument: Perform a dry run by passing 'true' as a second argument.
3rd argument: Skip installing tools by passing 'false' as a third argument (default is true).
**Example:**

Example: `rake release[2.1.0,false,false]`
```bash
rake release[16.2.0] # Release version 16.2.0
rake release[16.2.0,true] # Dry run to preview changes
rake release # Auto-bump patch version
```

Running `rake release[2.1.0]` will create a commit that looks like this:
### What Gets Released

The release task publishes three packages with the same version number:

1. **react-on-rails** NPM package
2. **react-on-rails-pro** NPM package
3. **react_on_rails** Ruby gem

### Version Synchronization

The task updates versions in all the following files:

- `lib/react_on_rails/version.rb` (source of truth)
- `package.json` (root workspace)
- `packages/react-on-rails/package.json`
- `packages/react-on-rails-pro/package.json` (both version field and react-on-rails dependency)
- `spec/dummy/Gemfile.lock`

**Note:** The `react-on-rails-pro` package declares an exact version dependency on `react-on-rails` (e.g., `"react-on-rails": "16.2.0"`). This ensures users install compatible versions of both packages.

### Pre-release Versions

For pre-release versions, the gem version format is automatically converted to NPM semver format:

- Gem: `3.0.0.beta.1`
- NPM: `3.0.0-beta.1`

### Release Process

When you run `rake release[X.Y.Z]`, the task will:

1. Check for uncommitted changes (will abort if found)
2. Pull latest changes from the remote repository
3. Clean up example directories
4. Bump the gem version in `lib/react_on_rails/version.rb`
5. Update all package.json files with the new version
6. Update the Pro package's dependency on react-on-rails
7. Update the dummy app's Gemfile.lock
8. Commit all version changes with message "Bump version to X.Y.Z"
9. Create a git tag `vX.Y.Z`
10. Push commits and tags to the remote repository
11. Publish `react-on-rails` to NPM (requires 2FA token)
12. Publish `react-on-rails-pro` to NPM (requires 2FA token)
13. Publish `react_on_rails` to RubyGems (requires 2FA token)

### Two-Factor Authentication

You'll need to enter OTP tokens when prompted:

- Once for publishing `react-on-rails` to NPM
- Once for publishing `react-on-rails-pro` to NPM
- Once for publishing `react_on_rails` to RubyGems

### Post-Release Steps

After a successful release, you'll see instructions to:

1. Update the CHANGELOG.md:

```bash
bundle exec rake update_changelog
```

2. Update the dummy app's Gemfile.lock:

```bash
cd spec/dummy && bundle update react_on_rails
```

3. Commit the CHANGELOG and Gemfile.lock:
```bash
cd /path/to/react_on_rails
git commit -a -m 'Update CHANGELOG.md and spec/dummy Gemfile.lock'
git push
```

## Requirements

This task depends on the `gem-release` Ruby gem, which is installed via `bundle install`.

For NPM publishing, you must be logged in to npm and have publish permissions for both packages:

```bash
npm login
```
commit d07005cde9784c69e41d73fb9a0ebe8922e556b3
Author: Rob Wise <robert.wise@outlook.com>
Date: Tue Jan 26 19:49:14 2016 -0500

Release 2.1.0
## Troubleshooting

### Dry Run First

Always test with a dry run before actually releasing:

```bash
rake release[16.2.0,true]
```

This shows you exactly what would be updated without making any changes.

### If Release Fails

If the release fails partway through (e.g., during NPM publish):

1. Check what was published:

- NPM: `npm view react-on-rails@X.Y.Z`
- RubyGems: `gem list react_on_rails -r -a`

2. If the git tag was created but packages weren't published:

- Delete the tag: `git tag -d vX.Y.Z && git push origin :vX.Y.Z`
- Revert the version commit: `git reset --hard HEAD~1 && git push -f`
- Start over with `rake release[X.Y.Z]`

3. If some packages were published but not others:
- You can manually publish the missing packages:
```bash
cd packages/react-on-rails && yarn publish --new-version X.Y.Z
cd ../react-on-rails-pro && yarn publish --new-version X.Y.Z
gem release
```

## Version History

Running `rake release[X.Y.Z]` will create a commit that looks like this:

```
commit abc123...
Author: Your Name <your.email@example.com>
Date: Mon Jan 1 12:00:00 2024 -0500

Bump version to 16.2.0

diff --git a/lib/react_on_rails/version.rb b/lib/react_on_rails/version.rb
index 3de9606..b71aa7a 100644
index 1234567..abcdefg 100644
--- a/lib/react_on_rails/version.rb
+++ b/lib/react_on_rails/version.rb
@@ -1,3 +1,3 @@
module ReactOnRails
- VERSION = "2.0.2".freeze
+ VERSION = "2.1.0".freeze
- VERSION = "16.1.1"
+ VERSION = "16.2.0"
end

diff --git a/package.json b/package.json
index aa7b000..af8761e 100644
index 2345678..bcdefgh 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "react-on-rails",
- "version": "2.0.2",
+ "version": "2.1.0",
"description": "react-on-rails JavaScript for react_on_rails Ruby gem",
"main": "packages/react-on-rails/lib/ReactOnRails.js",
"directories": {
diff --git a/spec/dummy/Gemfile.lock b/spec/dummy/Gemfile.lock
index 8ef51df..4489bfe 100644
--- a/spec/dummy/Gemfile.lock
+++ b/spec/dummy/Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: ../..
specs:
- react_on_rails (2.0.2)
+ react_on_rails (2.1.0)
connection_pool
execjs (~> 2.5)
rails (>= 3.2)
(END)
"name": "react-on-rails-workspace",
- "version": "16.1.1",
+ "version": "16.2.0",
...
}
```
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@
"yalc:publish": "yarn workspaces run yalc:publish",
"yalc": "yarn workspaces run yalc",
"publish": "yarn workspaces run publish",
"release:patch": "yarn workspaces run release:patch",
"release:minor": "yarn workspaces run release:minor",
"release:major": "yarn workspaces run release:major",
"postinstall": "test -f .lefthook.yml && test -d .git && command -v bundle >/dev/null 2>&1 && bundle exec lefthook install || true"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-on-rails-pro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"./ServerComponentFetchError": "./lib/ServerComponentFetchError.js"
},
"dependencies": {
"react-on-rails": "*"
"react-on-rails": "16.1.1"
},
"peerDependencies": {
"react": ">= 16",
Expand Down
5 changes: 1 addition & 4 deletions packages/react-on-rails/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
"prepare": "nps build.prepack",
"prepublishOnly": "yarn run build",
"yalc:publish": "yalc publish",
"yalc": "yalc",
"release:patch": "./scripts/release patch",
"release:minor": "./scripts/release minor",
"release:major": "./scripts/release major"
"yalc": "yalc"
},
"repository": {
"type": "git",
Expand Down
6 changes: 0 additions & 6 deletions packages/react-on-rails/scripts/release

This file was deleted.

Loading
Loading