|
1 | 1 | Releasing Grape |
2 | 2 | =============== |
3 | 3 |
|
4 | | -There're no particular rules about when to release Grape. Release bug fixes frequently, features not so frequently and breaking API changes rarely. |
| 4 | +There are no particular rules about when to release Grape. Release bug fixes frequently, features not so frequently and breaking API changes rarely. |
5 | 5 |
|
6 | | -### Release |
7 | | - |
8 | | -Run tests, check that all tests succeed locally. |
9 | | - |
10 | | -``` |
11 | | -bundle install |
12 | | -rake |
13 | | -``` |
14 | | - |
15 | | -Double-check that the [last build succeeded](https://github.com/ruby-grape/grape/actions) for all supported platforms. |
16 | | - |
17 | | -Those with r/w permissions to the [master Grape repository](https://github.com/ruby-grape/grape) generally have large Grape-based projects. Point one to Grape HEAD and run all your API tests to catch any obvious regressions. |
18 | | - |
19 | | -``` |
20 | | -gem grape, github: 'ruby-grape/grape' |
21 | | -``` |
22 | | - |
23 | | -Modify the "Stable Release" section in [README.md](README.md). Change the text to reflect that this is going to be the documentation for a stable release. Remove references to the previous release of Grape. Keep the file open, you'll have to undo this change after the release. |
24 | | - |
25 | | -``` |
26 | | -## Stable Release |
27 | | -
|
28 | | -You're reading the documentation for the stable release of Grape, 0.6.0. |
29 | | -``` |
30 | | - |
31 | | -Change "Next Release" in [CHANGELOG.md](CHANGELOG.md) to the new version. |
32 | | - |
33 | | -``` |
34 | | -#### 0.6.0 (2013/9/16) |
35 | | -``` |
| 6 | +### One-Time Setup |
36 | 7 |
|
37 | | -Remove the line with "Your contribution here.", since there will be no more contributions to this release. |
| 8 | +Releases use [ruby-gem-release 0.7.0](https://github.com/dblock/ruby-gem-release/tree/v0.7.0), pinned in the Gemfile and by commit SHA in the reusable workflow, and RubyGems Trusted Publishing without a stored RubyGems API key. The trusted publisher names the workflow repository but not a ref, so update both pins together and verify that the workflow SHA is the commit of the matching `vVERSION` tag. |
38 | 9 |
|
39 | | -Commit your changes. |
| 10 | +Create a GitHub environment named `release` in **Settings > Environments**. Configure required release-maintainer reviewers, prevent self-review where appropriate, and restrict deployments to `master`. Creating an unprotected environment alone does not restrict publication: repository writers can dispatch the workflow, and required reviewers gate publication. The release job installs the development and test bundle without a lockfile and runs RuboCop and the full suite while holding `id-token: write` and `contents: write`, so any gem in that bundle could request a publishing token. Approval controls when the job runs, not what runs in it; review dependency changes on `master` before approving. |
40 | 11 |
|
41 | | -``` |
42 | | -git add README.md CHANGELOG.md |
43 | | -git commit -m "Preparing for release, 0.6.0." |
44 | | -git push origin master |
45 | | -``` |
| 12 | +In the [grape trusted publishers settings](https://rubygems.org/gems/grape/trusted_publishers), configure these values: |
46 | 13 |
|
47 | | -Release. |
| 14 | +| Field | Value | |
| 15 | +| --- | --- | |
| 16 | +| Repository owner | `ruby-grape` | |
| 17 | +| Repository name | `grape` | |
| 18 | +| Workflow filename | `release.yml` | |
| 19 | +| Environment | `release` | |
| 20 | +| Workflow repository owner | `dblock` | |
| 21 | +| Workflow repository name | `ruby-gem-release` | |
48 | 22 |
|
49 | | -``` |
50 | | -$ rake release |
| 23 | +The workflow repository identifies the reusable workflow, not Grape's caller workflow. Ensure branch and tag rules permit `GITHUB_TOKEN` to push release commits to `master` and create `vVERSION` tags. If rules require PRs or checks that the release token cannot bypass, a repository administrator must establish an approved release policy before dispatching; the workflow does not change repository protections. |
51 | 24 |
|
52 | | -grape 0.6.0 built to pkg/grape-0.6.0.gem. |
53 | | -Tagged v0.6.0. |
54 | | -Pushed git commits and tags. |
55 | | -Pushed grape 0.6.0 to rubygems.org. |
56 | | -``` |
57 | | - |
58 | | -### Prepare for the Next Version |
| 25 | +### Release |
59 | 26 |
|
60 | | -Modify the "Stable Release" section in [README.md](README.md). Change the text to reflect that this is going to be the next release. |
| 27 | +Run tests and check that all tests succeed locally: |
61 | 28 |
|
| 29 | +```sh |
| 30 | +bundle install |
| 31 | +bundle exec rake |
| 32 | +bundle exec rake build |
62 | 33 | ``` |
63 | | -## Stable Release |
64 | 34 |
|
65 | | -You're reading the documentation for the next release of Grape, which should be 0.6.1. |
66 | | -The current stable release is [0.6.0](https://github.com/ruby-grape/grape/blob/v0.6.0/README.md). |
67 | | -``` |
| 35 | +The release specs use `ruby-gem-release/rspec` to exercise the production workflow and README hooks in a disposable Git repository, replacing registry and hosted publication with the library's local adapters. They do not publish to RubyGems or GitHub. |
68 | 36 |
|
69 | | -Add the next release to [CHANGELOG.md](CHANGELOG.md). |
| 37 | +Double-check that the [last build succeeded](https://github.com/ruby-grape/grape/actions) for all supported platforms. Point a Grape-based project at Grape HEAD and run its API tests to catch regressions: |
70 | 38 |
|
| 39 | +```ruby |
| 40 | +gem 'grape', github: 'ruby-grape/grape' |
71 | 41 | ``` |
72 | | -### 0.6.1 (Next) |
73 | | -
|
74 | | -#### Features |
75 | 42 |
|
76 | | -* Your contribution here. |
| 43 | +Review the next section of [CHANGELOG.md](CHANGELOG.md) and the version in [lib/grape/version.rb](lib/grape/version.rb). Keep one `* Your contribution here.` placeholder in each of Features and Fixes; ruby-gem-release preserves this two-section format. Actual release notes are required. |
77 | 44 |
|
78 | | -#### Fixes |
| 45 | +Dispatch **Release** from `master` in GitHub Actions, or run: |
79 | 46 |
|
80 | | -* Your contribution here. |
| 47 | +```sh |
| 48 | +gh workflow run release.yml --repo ruby-grape/grape --ref master |
81 | 49 | ``` |
82 | 50 |
|
83 | | -Bump the minor version in lib/grape/version.rb. |
| 51 | +To select a different release version without a separate version-bump commit, pass `-f version=4.2.0`. Dispatching authorizes publication once the `release` environment's approval requirements are satisfied; do not dispatch from PR CI or use it as a dry run. |
84 | 52 |
|
85 | | -```ruby |
86 | | -module Grape |
87 | | - VERSION = '0.6.1'.freeze |
88 | | -end |
89 | | -``` |
| 53 | +The workflow validates release preconditions, dates the changelog and removes both contribution placeholders, updates the README to describe the stable release, and runs `bundle exec rake`. It builds and preserves the gem and recovery artifacts, publishes that exact gem to RubyGems, pushes the release commit and tag, and creates a GitHub Release. It then increments the minor version, as Grape does after every release, and pushes the next development iteration with both changelog sections and the README's stable-release link restored. No manual release edits are needed; `rake release` stops and points here instead of publishing. |
90 | 54 |
|
91 | | -Commit your changes. |
| 55 | +### Recovery |
92 | 56 |
|
93 | | -``` |
94 | | -git add CHANGELOG.md README.md lib/grape/version.rb |
95 | | -git commit -m "Preparing for next development iteration, 0.6.1." |
96 | | -git push origin master |
97 | | -``` |
| 57 | +Inspect the failed run and its `release-gem-*` artifact before retrying. It can contain the built gem, checksum manifest, and Git recovery bundle. RubyGems publication cannot be undone by resetting Git: if a version was uploaded, never publish different bytes under that version or move its tag. Follow the [ruby-gem-release recovery guide](https://github.com/dblock/ruby-gem-release/blob/v0.7.0/RELEASING.md#verify-and-recover) to determine which steps completed and recover deliberately. |
98 | 58 |
|
99 | 59 | ### Make an Announcement |
100 | 60 |
|
101 | | -Make an announcement on the [ruby-grape@googlegroups.com](mailto:ruby-grape@googlegroups.com) mailing list. The general format is as follows. |
| 61 | +Make an announcement on the [ruby-grape@googlegroups.com](mailto:ruby-grape@googlegroups.com) mailing list: |
102 | 62 |
|
103 | | -``` |
104 | | -Grape 0.6.0 has been released. |
| 63 | +```text |
| 64 | +Grape 4.2.0 has been released. |
105 | 65 |
|
106 | | -There were 8 contributors to this release, not counting documentation. |
| 66 | +There were N contributors to this release, not counting documentation. |
107 | 67 |
|
108 | 68 | Please note the breaking API change in ... |
109 | 69 |
|
110 | 70 | [copy/paste CHANGELOG here] |
111 | | -
|
112 | 71 | ``` |
0 commit comments