Skip to content

Commit 8fab0d3

Browse files
author
github-actions
committed
Switch to trusted publishing workflow and run it on version.rb changes
1 parent 0c5c445 commit 8fab0d3

File tree

4 files changed

+39
-25
lines changed

4 files changed

+39
-25
lines changed

.github/workflows/publish.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Publish to RubyGems.org
2+
3+
on:
4+
push:
5+
branches: main
6+
paths: lib/zendesk_api/version.rb
7+
workflow_dispatch:
8+
9+
jobs:
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+
- name: Install dependencies
24+
run: bundle install
25+
- uses: rubygems/release-gem@v1

.github/workflows/publish_gem.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,6 @@ ticket = ZendeskAPI::Ticket.find(id: 1)
283283
requester = ZendeskAPI::User.find(id: ticket.requester_id)
284284
```
285285

286-
By explicitly fetching associated resources, you can ensure that your application only processes the data it needs, improving overall efficiency.
287-
288286
### Omnichannel
289287

290288
Support for the [Agent Availability API](https://developer.zendesk.com/api-reference/agent-availability/agent-availability-api/introduction/)
@@ -484,16 +482,19 @@ bundle exec rake # Runs the tests
484482
bundle exec rubocop # Runs the lint (use `--fix` for autocorrect)
485483
```
486484

487-
## Releasing a new gem version
485+
### Releasing a new version
486+
A new version is published to RubyGems.org every time a change to `version.rb` is pushed to the `main` branch.
487+
In short, follow these steps:
488+
1. Update `version.rb`,
489+
2. merge this change into `main`, and
490+
3. look at [the action](https://github.com/zendesk/zendesk_api_client_rb/actions/workflows/publish.yml) for output.
488491

489-
1. From updated master: `git checkout -b bump-vX.X.X`, according to [SemVer](https://semver.org)
490-
2. Ensure the CHANGELOG is correct and updated, this is your last opportunity
491-
3. Execute `bundle exec bump:patch # minor|major`, this bumps the version in a new commit, and adds the relative git tag
492-
4. Push to GitHub `git push origin vX.X.X -u && git push --tags`
493-
5. Raise a PR ([example](https://github.com/zendesk/zendesk_api_client_rb/pull/540)) including the code diff ([example](https://github.com/zendesk/zendesk_api_client_rb/compare/v2.0.1...v3.0.0.rc1))
494-
6. Get it approved and merged
495-
7. Post a message in Slack `#rest-api` (example **TODO**), so advocacy are aware that we are going to release a new gem, just in case any customer complains about something related to the gem
496-
8. After 2 hours from the above message, you can [approve the release of the gem](https://github.com/zendesk/zendesk_api_client_rb/deployments/activity_log?environment=rubygems-publish)
492+
To create a pre-release from a non-main branch:
493+
1. change the version in `version.rb` to something like `1.2.0.pre.1` or `2.0.0.beta.2`,
494+
2. push this change to your branch,
495+
3. go to [Actions → “Publish to RubyGems.org” on GitHub](https://github.com/zendesk/zendesk_api_client_rb/actions/workflows/publish.yml),
496+
4. click the “Run workflow” button,
497+
5. pick your branch from a dropdown.
497498

498499
## Contributing
499500

Rakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require 'rake/testtask'
2-
require 'bundler/gem_tasks'
2+
require 'bundler/setup'
33
require 'bump/tasks'
44
require 'rubocop/rake_task'
55

@@ -31,7 +31,7 @@ if defined?(RSpec)
3131
.sub("your_username", ENV.fetch("SPEC_LIVE_USERNAME"))
3232
.sub("your_password", ENV.fetch("SPEC_LIVE_PASSWORD"))
3333
.sub("your_zendesk_host", ENV.fetch("SPEC_LIVE_ZENDESK_HOST"))
34-
)
34+
)
3535
end
3636
end
3737

0 commit comments

Comments
 (0)