|
| 1 | +# Release Process |
| 2 | + |
| 3 | +This document describes how to release a new version of the `cypress-on-rails` gem. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +1. Install the `gem-release` gem globally: |
| 8 | + ```bash |
| 9 | + gem install gem-release |
| 10 | + ``` |
| 11 | + |
| 12 | +2. Ensure you have write access to the rubygems.org package |
| 13 | + |
| 14 | +3. Set up two-factor authentication (2FA) for RubyGems and have your OTP generator ready |
| 15 | + |
| 16 | +## Release Steps |
| 17 | + |
| 18 | +### 1. Prepare for Release |
| 19 | + |
| 20 | +Ensure your working directory is clean: |
| 21 | +```bash |
| 22 | +git status |
| 23 | +``` |
| 24 | + |
| 25 | +If you have uncommitted changes, commit or stash them first. |
| 26 | + |
| 27 | +### 2. Pull Latest Changes |
| 28 | + |
| 29 | +```bash |
| 30 | +git pull --rebase |
| 31 | +``` |
| 32 | + |
| 33 | +### 3. Run the Release Task |
| 34 | + |
| 35 | +To release a specific version: |
| 36 | +```bash |
| 37 | +rake release[1.19.0] |
| 38 | +``` |
| 39 | + |
| 40 | +To automatically bump the patch version: |
| 41 | +```bash |
| 42 | +rake release |
| 43 | +``` |
| 44 | + |
| 45 | +To perform a dry run (without actually publishing): |
| 46 | +```bash |
| 47 | +rake release[1.19.0,true] |
| 48 | +``` |
| 49 | + |
| 50 | +### 4. Enter Your OTP |
| 51 | + |
| 52 | +When prompted, enter your one-time password (OTP) from your authenticator app for RubyGems. |
| 53 | + |
| 54 | +If you get an error during gem publishing, you can run `gem release` manually to retry. |
| 55 | + |
| 56 | +### 5. Update the CHANGELOG |
| 57 | + |
| 58 | +After successfully publishing the gem, update the CHANGELOG: |
| 59 | + |
| 60 | +```bash |
| 61 | +bundle exec rake update_changelog |
| 62 | +# This will: |
| 63 | +# - Add a new version header with the release date |
| 64 | +# - Add version comparison links |
| 65 | +# - Prompt you to move content from [Unreleased] to the new version |
| 66 | + |
| 67 | +# Edit CHANGELOG.md to move unreleased changes to the new version section |
| 68 | +git commit -a -m 'Update CHANGELOG.md' |
| 69 | +git push |
| 70 | +``` |
| 71 | + |
| 72 | +## Version Numbering |
| 73 | + |
| 74 | +Follow [Semantic Versioning](https://semver.org/): |
| 75 | + |
| 76 | +- **Major version** (X.0.0): Breaking changes |
| 77 | +- **Minor version** (0.X.0): New features, backwards compatible |
| 78 | +- **Patch version** (0.0.X): Bug fixes, backwards compatible |
| 79 | +- **Pre-release versions**: Use dot notation, not dashes (e.g., `2.0.0.beta.1`, not `2.0.0-beta.1`) |
| 80 | + |
| 81 | +## What the Release Task Does |
| 82 | + |
| 83 | +The release task automates the following steps: |
| 84 | + |
| 85 | +1. Checks for uncommitted changes (will abort if found) |
| 86 | +2. Pulls the latest changes from the repository |
| 87 | +3. Bumps the version number in `lib/cypress_on_rails/version.rb` |
| 88 | +4. Creates a git commit with the version bump |
| 89 | +5. Creates a git tag for the new version |
| 90 | +6. Pushes the commit and tag to GitHub |
| 91 | +7. Builds the gem |
| 92 | +8. Publishes the gem to RubyGems |
| 93 | + |
| 94 | +## Troubleshooting |
| 95 | + |
| 96 | +### Authentication Error |
| 97 | + |
| 98 | +If you get an authentication error with RubyGems: |
| 99 | +1. Verify your OTP is correct and current |
| 100 | +2. Ensure your RubyGems API key is valid |
| 101 | +3. Run `gem release` manually to retry |
| 102 | + |
| 103 | +### Version Already Exists |
| 104 | + |
| 105 | +If the version already exists on RubyGems: |
| 106 | +1. Bump to a higher version number |
| 107 | +2. Or fix the version in `lib/cypress_on_rails/version.rb` and try again |
| 108 | + |
| 109 | +### Uncommitted Changes Error |
| 110 | + |
| 111 | +If you have uncommitted changes: |
| 112 | +1. Review your changes with `git status` |
| 113 | +2. Commit them with `git commit -am "Your message"` |
| 114 | +3. Or stash them with `git stash` |
| 115 | +4. Then retry the release |
| 116 | + |
| 117 | +## Post-Release |
| 118 | + |
| 119 | +After releasing: |
| 120 | + |
| 121 | +1. Announce the release on relevant channels (Slack, forum, etc.) |
| 122 | +2. Update any documentation that references version numbers |
| 123 | +3. Consider creating a GitHub release with release notes |
0 commit comments