-
-
Notifications
You must be signed in to change notification settings - Fork 638
Modernize release process for monorepo #1856
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
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
34f9363
Modernize release process for monorepo
AbanoubGhadban ffc8950
Fix syntax error and RuboCop violations in release.rake
AbanoubGhadban 604b823
Add skip_push option to release task
AbanoubGhadban 2dc17f0
Add parameter validation for registry and skip_push
AbanoubGhadban 76dc266
run bundle on the gem root while releasing
AbanoubGhadban 324fb8c
update dependency version of rorp package to 16.1.2
AbanoubGhadban aeac459
Revert "update dependency version of rorp package to 16.1.2"
AbanoubGhadban 1ddaf2d
update dependency version of rorp package to 16.1.1
AbanoubGhadban File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 <[email protected]> | ||
| 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 [email protected]` | ||
| - 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 <[email protected]> | ||
| 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", | ||
| ... | ||
| } | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.