|
1 | 1 | # Install and Release |
2 | 2 |
|
3 | | -We're now releasing this as a combined ruby gem plus npm package. We will keep the version numbers in sync. |
| 3 | +We're releasing this as a combined Ruby gem plus two NPM packages. We keep the version numbers in sync across all packages. |
4 | 4 |
|
5 | 5 | ## Testing the Gem before Release from a Rails App |
6 | 6 |
|
7 | 7 | See [Contributing](https://github.com/shakacode/react_on_rails/tree/master/CONTRIBUTING.md) |
8 | 8 |
|
9 | | -## Releasing a new gem version |
| 9 | +## Releasing a New Version |
10 | 10 |
|
11 | 11 | Run `rake -D release` to see instructions on how to release via the rake task. |
12 | 12 |
|
13 | | -As of 01-26-2016, this would give you an output like this: |
| 13 | +### Release Command |
14 | 14 |
|
| 15 | +```bash |
| 16 | +rake release[gem_version,dry_run] |
15 | 17 | ``` |
16 | | -rake release[gem_version,dry_run,tools_install] |
17 | | - Releases both the gem and node package using the given version. |
18 | 18 |
|
19 | | - IMPORTANT: the gem version must be in valid rubygem format (no dashes). |
20 | | - It will be automatically converted to a valid npm semver by the rake task |
21 | | - for the node package version. This only makes a difference for pre-release |
22 | | - versions such as `3.0.0.beta.1` (npm version would be `3.0.0-beta.1`). |
| 19 | +**Arguments:** |
23 | 20 |
|
24 | | - This task will also globally install gem-release (ruby gem) and |
25 | | - release-it (node package) unless you specify skip installing tools. |
| 21 | +- `gem_version`: The new version in rubygem format (no dashes). Pass no argument to automatically perform a patch version bump. |
| 22 | +- `dry_run`: Optional. Pass `true` to see what would happen without actually releasing. |
26 | 23 |
|
27 | | - 2nd argument: Perform a dry run by passing 'true' as a second argument. |
28 | | - 3rd argument: Skip installing tools by passing 'false' as a third argument (default is true). |
| 24 | +**Example:** |
29 | 25 |
|
30 | | - Example: `rake release[2.1.0,false,false]` |
| 26 | +```bash |
| 27 | +rake release[16.2.0] # Release version 16.2.0 |
| 28 | +rake release[16.2.0,true] # Dry run to preview changes |
| 29 | +rake release # Auto-bump patch version |
31 | 30 | ``` |
32 | 31 |
|
33 | | -Running `rake release[2.1.0]` will create a commit that looks like this: |
| 32 | +### What Gets Released |
34 | 33 |
|
| 34 | +The release task publishes three packages with the same version number: |
| 35 | + |
| 36 | +1. **react-on-rails** NPM package |
| 37 | +2. **react-on-rails-pro** NPM package |
| 38 | +3. **react_on_rails** Ruby gem |
| 39 | + |
| 40 | +### Version Synchronization |
| 41 | + |
| 42 | +The task updates versions in all the following files: |
| 43 | + |
| 44 | +- `lib/react_on_rails/version.rb` (source of truth) |
| 45 | +- `package.json` (root workspace) |
| 46 | +- `packages/react-on-rails/package.json` |
| 47 | +- `packages/react-on-rails-pro/package.json` (both version field and react-on-rails dependency) |
| 48 | +- `spec/dummy/Gemfile.lock` |
| 49 | + |
| 50 | +**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. |
| 51 | + |
| 52 | +### Pre-release Versions |
| 53 | + |
| 54 | +For pre-release versions, the gem version format is automatically converted to NPM semver format: |
| 55 | + |
| 56 | +- Gem: `3.0.0.beta.1` |
| 57 | +- NPM: `3.0.0-beta.1` |
| 58 | + |
| 59 | +### Release Process |
| 60 | + |
| 61 | +When you run `rake release[X.Y.Z]`, the task will: |
| 62 | + |
| 63 | +1. Check for uncommitted changes (will abort if found) |
| 64 | +2. Pull latest changes from the remote repository |
| 65 | +3. Clean up example directories |
| 66 | +4. Bump the gem version in `lib/react_on_rails/version.rb` |
| 67 | +5. Update all package.json files with the new version |
| 68 | +6. Update the Pro package's dependency on react-on-rails |
| 69 | +7. Update the dummy app's Gemfile.lock |
| 70 | +8. Commit all version changes with message "Bump version to X.Y.Z" |
| 71 | +9. Create a git tag `vX.Y.Z` |
| 72 | +10. Push commits and tags to the remote repository |
| 73 | +11. Publish `react-on-rails` to NPM (requires 2FA token) |
| 74 | +12. Publish `react-on-rails-pro` to NPM (requires 2FA token) |
| 75 | +13. Publish `react_on_rails` to RubyGems (requires 2FA token) |
| 76 | + |
| 77 | +### Two-Factor Authentication |
| 78 | + |
| 79 | +You'll need to enter OTP tokens when prompted: |
| 80 | + |
| 81 | +- Once for publishing `react-on-rails` to NPM |
| 82 | +- Once for publishing `react-on-rails-pro` to NPM |
| 83 | +- Once for publishing `react_on_rails` to RubyGems |
| 84 | + |
| 85 | +### Post-Release Steps |
| 86 | + |
| 87 | +After a successful release, you'll see instructions to: |
| 88 | + |
| 89 | +1. Update the CHANGELOG.md: |
| 90 | + |
| 91 | + ```bash |
| 92 | + bundle exec rake update_changelog |
| 93 | + ``` |
| 94 | + |
| 95 | +2. Update the dummy app's Gemfile.lock: |
| 96 | + |
| 97 | + ```bash |
| 98 | + cd spec/dummy && bundle update react_on_rails |
| 99 | + ``` |
| 100 | + |
| 101 | +3. Commit the CHANGELOG and Gemfile.lock: |
| 102 | + ```bash |
| 103 | + cd /path/to/react_on_rails |
| 104 | + git commit -a -m 'Update CHANGELOG.md and spec/dummy Gemfile.lock' |
| 105 | + git push |
| 106 | + ``` |
| 107 | + |
| 108 | +## Requirements |
| 109 | + |
| 110 | +This task depends on the `gem-release` Ruby gem, which is installed via `bundle install`. |
| 111 | + |
| 112 | +For NPM publishing, you must be logged in to npm and have publish permissions for both packages: |
| 113 | + |
| 114 | +```bash |
| 115 | +npm login |
35 | 116 | ``` |
36 | | -commit d07005cde9784c69e41d73fb9a0ebe8922e556b3 |
37 | | -Author: Rob Wise <robert.wise@outlook.com> |
38 | | -Date: Tue Jan 26 19:49:14 2016 -0500 |
39 | 117 |
|
40 | | - Release 2.1.0 |
| 118 | +## Troubleshooting |
| 119 | + |
| 120 | +### Dry Run First |
| 121 | + |
| 122 | +Always test with a dry run before actually releasing: |
| 123 | + |
| 124 | +```bash |
| 125 | +rake release[16.2.0,true] |
| 126 | +``` |
| 127 | + |
| 128 | +This shows you exactly what would be updated without making any changes. |
| 129 | + |
| 130 | +### If Release Fails |
| 131 | + |
| 132 | +If the release fails partway through (e.g., during NPM publish): |
| 133 | + |
| 134 | +1. Check what was published: |
| 135 | + |
| 136 | + - NPM: `npm view react-on-rails@X.Y.Z` |
| 137 | + - RubyGems: `gem list react_on_rails -r -a` |
| 138 | + |
| 139 | +2. If the git tag was created but packages weren't published: |
| 140 | + |
| 141 | + - Delete the tag: `git tag -d vX.Y.Z && git push origin :vX.Y.Z` |
| 142 | + - Revert the version commit: `git reset --hard HEAD~1 && git push -f` |
| 143 | + - Start over with `rake release[X.Y.Z]` |
| 144 | + |
| 145 | +3. If some packages were published but not others: |
| 146 | + - You can manually publish the missing packages: |
| 147 | + ```bash |
| 148 | + cd packages/react-on-rails && yarn publish --new-version X.Y.Z |
| 149 | + cd ../react-on-rails-pro && yarn publish --new-version X.Y.Z |
| 150 | + gem release |
| 151 | + ``` |
| 152 | + |
| 153 | +## Version History |
| 154 | + |
| 155 | +Running `rake release[X.Y.Z]` will create a commit that looks like this: |
| 156 | + |
| 157 | +``` |
| 158 | +commit abc123... |
| 159 | +Author: Your Name <your.email@example.com> |
| 160 | +Date: Mon Jan 1 12:00:00 2024 -0500 |
| 161 | + |
| 162 | + Bump version to 16.2.0 |
41 | 163 |
|
42 | 164 | diff --git a/lib/react_on_rails/version.rb b/lib/react_on_rails/version.rb |
43 | | -index 3de9606..b71aa7a 100644 |
| 165 | +index 1234567..abcdefg 100644 |
44 | 166 | --- a/lib/react_on_rails/version.rb |
45 | 167 | +++ b/lib/react_on_rails/version.rb |
46 | 168 | @@ -1,3 +1,3 @@ |
47 | 169 | module ReactOnRails |
48 | | -- VERSION = "2.0.2".freeze |
49 | | -+ VERSION = "2.1.0".freeze |
| 170 | +- VERSION = "16.1.1" |
| 171 | ++ VERSION = "16.2.0" |
50 | 172 | end |
| 173 | + |
51 | 174 | diff --git a/package.json b/package.json |
52 | | -index aa7b000..af8761e 100644 |
| 175 | +index 2345678..bcdefgh 100644 |
53 | 176 | --- a/package.json |
54 | 177 | +++ b/package.json |
55 | 178 | @@ -1,6 +1,6 @@ |
56 | 179 | { |
57 | | - "name": "react-on-rails", |
58 | | -- "version": "2.0.2", |
59 | | -+ "version": "2.1.0", |
60 | | - "description": "react-on-rails JavaScript for react_on_rails Ruby gem", |
61 | | - "main": "packages/react-on-rails/lib/ReactOnRails.js", |
62 | | - "directories": { |
63 | | -diff --git a/spec/dummy/Gemfile.lock b/spec/dummy/Gemfile.lock |
64 | | -index 8ef51df..4489bfe 100644 |
65 | | ---- a/spec/dummy/Gemfile.lock |
66 | | -+++ b/spec/dummy/Gemfile.lock |
67 | | -@@ -1,7 +1,7 @@ |
68 | | - PATH |
69 | | - remote: ../.. |
70 | | - specs: |
71 | | -- react_on_rails (2.0.2) |
72 | | -+ react_on_rails (2.1.0) |
73 | | - connection_pool |
74 | | - execjs (~> 2.5) |
75 | | - rails (>= 3.2) |
76 | | -(END) |
| 180 | + "name": "react-on-rails-workspace", |
| 181 | +- "version": "16.1.1", |
| 182 | ++ "version": "16.2.0", |
| 183 | + ... |
| 184 | +} |
77 | 185 | ``` |
0 commit comments