Skip to content

Commit 6929047

Browse files
committed
Add release workflow
Don't push the gems to rubygems manually anymore We are going to do in the GithUb action.
1 parent b59a6a9 commit 6929047

File tree

3 files changed

+60
-41
lines changed

3 files changed

+60
-41
lines changed

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
release:
9+
permissions:
10+
contents: write
11+
id-token: write
12+
13+
environment: release
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Set up Ruby
20+
uses: ruby/setup-ruby@v1
21+
with:
22+
ruby-version: ruby
23+
- uses: actions/setup-node@v4
24+
with:
25+
node-version: lts/*
26+
registry-url: 'https://registry.npmjs.org'
27+
- name: Configure trusted publishing credentials
28+
uses: rubygems/[email protected]
29+
- name: Bundle install
30+
run: bundle install
31+
working-directory: tools/releaser
32+
- name: Run release rake task
33+
run: bundle exec rake push
34+
shell: bash
35+
working-directory: tools/releaser
36+
env:
37+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
38+
- name: Wait for release to propagate
39+
run: gem exec rubygems-await pkg/*.gem
40+
shell: bash

RELEASING_RAILS.md

Lines changed: 18 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Obviously Rails cannot be released when it depends on unreleased code.
2424
Contact the authors of those particular gems and work out a release date that
2525
suits them.
2626

27-
### Announce your plans to the rest of the team on Campfire
27+
### Announce your plans to the rest of the team on Basecamp
2828

2929
Let them know of your plans to release.
3030

@@ -56,58 +56,38 @@ Include an RC number if appropriate, e.g. `6.0.0.rc1`.
5656

5757
### Build and test the gem.
5858

59-
Run `rake verify` to generate the gems and install them locally. `verify` also
60-
generates a Rails app with a migration and boots it to smoke test with in your
61-
browser.
59+
Run `rake install` to generate the gems and install them locally. You can now
60+
use the version installed locally to generate a new app and check if everything
61+
is working as expected.
6262

6363
This will stop you from looking silly when you push an RC to rubygems.org and
6464
then realize it is broken.
6565

66-
### Check credentials for RubyGems, npm, and GitHub
67-
68-
For npm run `npm whoami` to check that you are logged in (`npm login` if not).
69-
70-
For RubyGems run `gem login`. If there's no output you are logged in.
66+
### Check credentials for GitHub
7167

7268
For GitHub run `gh auth status` to check that you are logged in (run `gh login` if not).
7369

74-
npm and RubyGems require MFA. The release task will attempt to use a yubikey if
75-
available, which as we have release several packages at once is strongly
76-
recommended. Check that `ykman oath accounts list` has an entry for both
77-
`npmjs.com` and `rubygems.org`, if not refer to
78-
https://tenderlovemaking.com/2021/10/26/publishing-gems-with-your-yubikey.html
79-
for setup instructions.
80-
81-
### Release to RubyGems and npm.
82-
83-
IMPORTANT: Several gems have JavaScript components that are released as npm
84-
packages, so you must have Node.js installed, have an npm account (npmjs.com),
85-
and be a package owner for `@rails/actioncable`, `@rails/actiontext`, and
86-
`@rails/activestorage`. You can check this by making sure your
87-
npm user (`npm whoami`) is listed as an owner (`npm owner ls <pkg>`) of each
88-
package. Do not release until you're set up with npm!
89-
9070
The release task will sign the release tag. If you haven't got commit signing
9171
set up, use https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work as a
9272
guide. You can generate keys with the GPG suite from here: https://gpgtools.org.
9373

94-
Run `rake changelog:header` to put a header with the new version in every
95-
CHANGELOG. Don't commit this, the release task handles it.
74+
Run `rake prep_release` to prepare the release. This will populate the gemspecs and
75+
npm package.json with the current RAILS_VERSION, add the header to the CHANGELOGs,
76+
build the gems, and check if bundler can resolve the dependencies.
9677

97-
Run `rake release`. This will populate the gemspecs and npm package.json with
98-
the current RAILS_VERSION, commit the changes, tag it, and push the gems to
99-
rubygems.org.
78+
You can now inspect the results in the diff and see if you are happy with the
79+
changes.
10080

101-
### Make GitHub Releases from pushed tags
81+
To release, Run `rake release`. This will commit the changes, tag it, and create a GitHub
82+
release with the proper release notes in draft mode.
10283

103-
We use GitHub Releases to publish the combined release summary for all gems. We
104-
can use a rake task and [GitHub cli](https://cli.github.com/) to do this
105-
(releases can also be created or edited on the web).
84+
Open the corresponding GitHub release draft and check that the release notes
85+
are correct. If everything is fine, publish the release.
10686

107-
```
108-
bundle exec rake changelog:release_summary > ../6-1-7-release-summary.md
109-
gh release create v6.1.7 -R rails/rails -F ../6-1-7-release-summary.md
110-
```
87+
### Publish the gems
88+
89+
To publish the gems approve the [Release workflow in GitHub Actions](https://github.com/rails/rails/actions/workflows/release.yml),
90+
that was created after the release was published.
11191

11292
### Send Rails release announcements
11393

@@ -117,7 +97,6 @@ lists where you should announce:
11797

11898
* [rubyonrails-core](https://discuss.rubyonrails.org/c/rubyonrails-core)
11999
* [rubyonrails-talk](https://discuss.rubyonrails.org/c/rubyonrails-talk)
120-
121100

122101
Use Markdown format for your announcement. Remember to ask people to report
123102
issues with the release candidate to the rails-core mailing list.

tools/releaser/lib/releaser.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def define
157157
end
158158

159159
desc "Release all gems and create a tag"
160-
task release: %w(check_gh_client prep_release commit tag create_release push)
160+
task release: %w(check_gh_client prep_release commit tag create_release)
161161

162162
desc "Push the gem to rubygems.org and the npm package to npmjs.com"
163163
task push: FRAMEWORKS.map { |f| "#{f}:push" } + ["rails:push"]
@@ -288,7 +288,7 @@ def inexistent_tag?
288288
def npm_otp
289289
" --otp " + ykman("npmjs.com")
290290
rescue
291-
""
291+
" --provenance --access public"
292292
end
293293

294294
def gem_otp

0 commit comments

Comments
 (0)