Skip to content

Commit 9625d7b

Browse files
authored
Merge pull request #50 from zendesk/trusted_publishing
Switch to trusted publishing workflow and run it on version.rb changes
2 parents c6dbb36 + 29785c0 commit 9625d7b

File tree

4 files changed

+42
-9
lines changed

4 files changed

+42
-9
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 Gem
1+
name: Publish to RubyGems.org
22

33
on:
44
push:
5-
tags: v*
5+
branches: main
6+
paths: lib/migration_tools/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+
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
@@ -30,7 +30,6 @@ The names of the possible groups are predefined to avoid turning this solution i
3030

3131
*change* this is a special group that you run whenever you want to change DB data which you'd otherwise do in script/console
3232

33-
3433
## Commands
3534

3635
The list commands
@@ -54,6 +53,21 @@ The group commands
5453
```
5554
Note that rake db:migrate is entirely unaffected by this.
5655

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

5973
Copyright 2015 Zendesk

lib/migration_tools/version.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module MigrationTools
2+
VERSION = "1.10.0"
3+
end

migration_tools.gemspec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
Gem::Specification.new "migration_tools", "1.10.0" do |s|
1+
require_relative "lib/migration_tools/version"
2+
3+
Gem::Specification.new "migration_tools", MigrationTools::VERSION do |s|
24
s.description = "Rake tasks for Rails that add groups to migrations"
35
s.summary = "Encourage migrations that do not require downtime"
46
s.homepage = "https://github.com/zendesk/migration_tools"

0 commit comments

Comments
 (0)