Skip to content

Commit 0509d2d

Browse files
authored
Add OIDC-based release workflow on tag push (#22)
* Add OIDC-based release workflow on tag push * Bump actions/checkout to v6 and drop bundler/gem_tasks Releases now run from CI via OIDC, so the local rake release/build/install tasks are no longer needed. Build locally with 'gem build sparoid.gemspec' if needed. * Update README release instructions for tag-push CI flow * Address PR review comments - Indent steps in main.yml under 'steps:' (cosmetic) - Restore bundler/gem_tasks for 'rake install'; release path is now CI-only via the new tag-push workflow - README: keep 'rake install' as the local install command
1 parent a08d188 commit 0509d2d

3 files changed

Lines changed: 35 additions & 7 deletions

File tree

.github/workflows/main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
ruby: [ 3.2, 3.3, 3.4, 4.0, ruby-head ]
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v4
18-
- uses: ruby/setup-ruby@v1
19-
with:
20-
ruby-version: ${{ matrix.ruby }}
21-
bundler-cache: true
22-
- run: bundle exec rake
17+
- uses: actions/checkout@v6
18+
- uses: ruby/setup-ruby@v1
19+
with:
20+
ruby-version: ${{ matrix.ruby }}
21+
bundler-cache: true
22+
- run: bundle exec rake

.github/workflows/release.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
id-token: write
14+
steps:
15+
- uses: actions/checkout@v6
16+
- uses: ruby/setup-ruby@v1
17+
with:
18+
ruby-version: '3.4'
19+
bundler-cache: true
20+
- uses: rubygems/release-gem@v1

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,15 @@ Host *.example.com
3434

3535
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
3636

37-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
37+
To install this gem onto your local machine, run `bundle exec rake install`.
38+
39+
To release a new version:
40+
41+
1. Bump `Sparoid::VERSION` in `lib/sparoid/version.rb` and add an entry to `CHANGELOG.md`.
42+
2. Open a PR with the bump, get it merged into `main`.
43+
3. Push a tag matching the new version, e.g. `git tag v2.1.2 && git push origin v2.1.2`.
44+
45+
The `Release` GitHub Actions workflow then builds the gem and publishes it to [rubygems.org](https://rubygems.org) via OIDC trusted publishing — no API key required.
3846

3947
## Contributing
4048

0 commit comments

Comments
 (0)