Skip to content

Commit 0d2a681

Browse files
authored
Merge pull request #32 from zendesk/trusted_publishing
Switch to trusted publishing workflow and run it on version.rb changes
2 parents 23cc1a4 + abad677 commit 0d2a681

File tree

3 files changed

+37
-10
lines changed

3 files changed

+37
-10
lines changed

.github/workflows/publish.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
1-
name: Publish public gem
1+
name: Publish to RubyGems.org
22

33
on:
44
push:
5-
tags: v*
5+
branches: main
6+
paths: lib/phenix/version.rb
7+
workflow_dispatch:
68

79
jobs:
8-
call-workflow:
9-
uses: zendesk/gw/.github/workflows/ruby-gem-publication.yml@main
10-
secrets:
11-
RUBY_GEMS_API_KEY: ${{ secrets.RUBY_GEMS_API_KEY }}
12-
RUBY_GEMS_TOTP_DEVICE: ${{ secrets.RUBY_GEMS_TOTP_DEVICE }}
10+
publish:
11+
runs-on: ubuntu-latest
12+
environment: rubygems-publish
13+
if: github.repository_owner == 'zendesk'
14+
permissions:
15+
id-token: write
16+
contents: write
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Set up Ruby
20+
uses: ruby/setup-ruby@v1
21+
with:
22+
bundler-cache: false
23+
ruby-version: "3.4"
24+
- name: Install dependencies
25+
run: bundle install
26+
- uses: rubygems/release-gem@v1

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,27 @@ Or install it yourself as:
4141
end
4242
```
4343

44-
4544
## How do I run tests?
4645

4746
`bundle exec rspec`
4847
This will assume that your DB is accessible via localhost for root with no password.
4948
For a different configuration, you can use the MYSQL_URL environment variable (see test/complex_database.yml).
5049

50+
### Releasing a new version
51+
A new version is published to RubyGems.org every time a change to `version.rb` is pushed to the `main` branch.
52+
In short, follow these steps:
53+
1. Update `version.rb`,
54+
2. update version in all `Gemfile.lock` files,
55+
3. merge this change into `main`, and
56+
4. look at [the action](https://github.com/zendesk/phenix/actions/workflows/publish.yml) for output.
57+
58+
To create a pre-release from a non-main branch:
59+
1. change the version in `version.rb` to something like `1.2.0.pre.1` or `2.0.0.beta.2`,
60+
2. push this change to your branch,
61+
3. go to [Actions → “Publish to RubyGems.org” on GitHub](https://github.com/zendesk/phenix/actions/workflows/publish.yml),
62+
4. click the “Run workflow” button,
63+
5. pick your branch from a dropdown.
64+
5165
## Contributing
5266

5367
Bug reports and pull requests are welcome on GitHub at https://github.com/zendesk/phenix.

Rakefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
require 'bundler/setup'
12
require 'bundler/gem_tasks'
23
require 'rspec/core/rake_task'
34

4-
ENV["gem_push"] = "false"
5-
65
RSpec::Core::RakeTask.new(:spec)
76

87
task default: :spec

0 commit comments

Comments
 (0)