|
| 1 | +# Release Process |
| 2 | + |
| 3 | +This repository uses an automated release pipeline via GitHub Actions. |
| 4 | + |
| 5 | +## How It Works |
| 6 | + |
| 7 | +The release workflow (`.github/workflows/release.yml`) is triggered when a version tag is pushed to the repository. The workflow: |
| 8 | + |
| 9 | +1. **Runs tests** - Ensures all tests pass before releasing |
| 10 | +2. **Builds the gem** - Creates the `.gem` package using `bundle exec rake build` |
| 11 | +3. **Generates checksums** - Creates SHA-512 checksums for the gem package |
| 12 | +4. **Creates GitHub Release** - Publishes a release on GitHub with the gem and checksums as artifacts |
| 13 | +5. **Publishes to RubyGems** - Automatically pushes the gem to [rubygems.org](https://rubygems.org) |
| 14 | + |
| 15 | +## Triggering a Release |
| 16 | + |
| 17 | +### For Stable Releases |
| 18 | + |
| 19 | +1. Update the version in `lib/cyclonedx/ruby/version.rb` |
| 20 | +2. Update `CHANGELOG.md` with the changes |
| 21 | +3. Commit the changes: `git commit -am "🔖 Prepare release v1.2.0"` |
| 22 | +4. Create and push a tag: `git tag v1.2.0 && git push origin v1.2.0` |
| 23 | + |
| 24 | +### For Prereleases |
| 25 | + |
| 26 | +Prereleases follow the same process but use a tag with a prerelease identifier: |
| 27 | + |
| 28 | +- Alpha: `git tag v1.3.0-alpha.1 && git push origin v1.3.0-alpha.1` |
| 29 | +- Beta: `git tag v1.3.0-beta.1 && git push origin v1.3.0-beta.1` |
| 30 | +- Release Candidate: `git tag v1.3.0-rc.1 && git push origin v1.3.0-rc.1` |
| 31 | + |
| 32 | +Prereleases are automatically detected by the workflow and marked as "prerelease" on GitHub. |
| 33 | + |
| 34 | +## Version Tag Format |
| 35 | + |
| 36 | +- **Stable releases**: `v<MAJOR>.<MINOR>.<PATCH>` (e.g., `v1.2.0`) |
| 37 | +- **Prereleases**: `v<MAJOR>.<MINOR>.<PATCH>-<PRERELEASE>` (e.g., `v1.3.0-alpha.1`) |
| 38 | + |
| 39 | +The version in the tag must match the version in `lib/cyclonedx/ruby/version.rb`. |
| 40 | + |
| 41 | +## Required Secrets |
| 42 | + |
| 43 | +The workflow requires the following GitHub repository secret to be configured: |
| 44 | + |
| 45 | +### `RUBYGEMS_API_KEY` |
| 46 | + |
| 47 | +This is your RubyGems API key for publishing gems. To set it up: |
| 48 | + |
| 49 | +1. Generate an API key on [rubygems.org](https://rubygems.org/profile/edit): |
| 50 | + - Go to your profile → Edit Profile → API Keys |
| 51 | + - Create a new API key with "Push rubygem" scope |
| 52 | + |
| 53 | +2. Add it to GitHub repository secrets: |
| 54 | + - Go to repository Settings → Secrets and variables → Actions |
| 55 | + - Click "New repository secret" |
| 56 | + - Name: `RUBYGEMS_API_KEY` |
| 57 | + - Value: Your RubyGems API key |
| 58 | + - Click "Add secret" |
| 59 | + |
| 60 | +**Note**: The `publish` job only runs on the official repository (`CycloneDX/cyclonedx-ruby-gem`) to prevent accidental publishes from forks. |
| 61 | + |
| 62 | +## Release Artifacts |
| 63 | + |
| 64 | +Each release includes the following artifacts: |
| 65 | + |
| 66 | +1. **Gem Package** (`cyclonedx-ruby-<version>.gem`) - The built Ruby gem |
| 67 | +2. **SHA-512 Checksum** (`cyclonedx-ruby-<version>.gem.sha512`) - Checksum for verification |
| 68 | + |
| 69 | +These artifacts are attached to the GitHub Release and can be downloaded for verification. |
| 70 | + |
| 71 | +## Monitoring Releases |
| 72 | + |
| 73 | +- **GitHub Actions**: Check the [Actions tab](https://github.com/CycloneDX/cyclonedx-ruby-gem/actions) for workflow runs |
| 74 | +- **GitHub Releases**: View all releases in the [Releases section](https://github.com/CycloneDX/cyclonedx-ruby-gem/releases) |
| 75 | +- **RubyGems**: Check [rubygems.org/gems/cyclonedx-ruby](https://rubygems.org/gems/cyclonedx-ruby) for published versions |
| 76 | + |
| 77 | +## Troubleshooting |
| 78 | + |
| 79 | +### Release workflow fails on tests |
| 80 | + |
| 81 | +The workflow will not create a release if tests fail. Fix the failing tests and push a new commit, then create the tag again. |
| 82 | + |
| 83 | +### Gem fails to publish to RubyGems |
| 84 | + |
| 85 | +Check that: |
| 86 | +- The `RUBYGEMS_API_KEY` secret is set correctly |
| 87 | +- The API key has the "Push rubygem" permission |
| 88 | +- The gem version doesn't already exist on RubyGems (versions cannot be overwritten) |
| 89 | + |
| 90 | +### Prerelease not detected correctly |
| 91 | + |
| 92 | +Ensure your tag follows the format `v<VERSION>-<PRERELEASE>` where `<PRERELEASE>` contains a hyphen or dot (e.g., `alpha.1`, `beta-2`, `rc.1`). |
0 commit comments