|
| 1 | +# Release Gem GitHub Action |
| 2 | + |
| 3 | +This action allows you to automate releasing your gems to RubyGems.org. |
| 4 | + |
| 5 | +## Usage |
| 6 | + |
| 7 | +### Trusted Publishing |
| 8 | + |
| 9 | +This example jumps right into RubyGems.org's current reccomended best practice. |
| 10 | + |
| 11 | +This action supports RubyGems.org's [trusted publishing] implementation, |
| 12 | +which allows authenticating to RubyGems.org without manually configuring secrets. |
| 13 | +To perform [trusted publishing] with this action, your projects publisher must already be |
| 14 | +[configured on RubyGems.org]. |
| 15 | + |
| 16 | +To enter the trusted publishing flow, configure this action's job with the |
| 17 | +`id-token: write` permission. |
| 18 | + |
| 19 | +```yaml |
| 20 | +# .github/workflows/push_gem.yml |
| 21 | +jobs: |
| 22 | + push: |
| 23 | + name: Push gem to RubyGems.org |
| 24 | + runs-on: ubuntu-latest |
| 25 | + |
| 26 | + permissions: |
| 27 | + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing |
| 28 | + contents: write # IMPORTANT: this permission is required for `rake release` to push the release tag |
| 29 | + |
| 30 | + steps: |
| 31 | + # Set up |
| 32 | + - uses: actions/checkout@v4 |
| 33 | + - name: Set up Ruby |
| 34 | + uses: ruby/setup-ruby@v1 |
| 35 | + with: |
| 36 | + bundler-cache: true |
| 37 | + ruby-version: ruby |
| 38 | + |
| 39 | + # Release |
| 40 | + - uses: rubygems/release-gem@v1 |
| 41 | +``` |
| 42 | +
|
| 43 | +### Requirements |
| 44 | +
|
| 45 | +For now, this action makes several assumptions about your project: |
| 46 | +
|
| 47 | +1. Your workflow checks out the repository & configures a working Ruby environment |
| 48 | +2. Your project uses [bundler] to manage dependencies |
| 49 | +3. Your project has the [bundler release tasks] configured |
| 50 | +4. Your gem has [trusted publishing] [configured on RubyGems.org] |
| 51 | +
|
| 52 | +[bundler]: https://bundler.io |
| 53 | +[bundler release tasks]: https://bundler.io/guides/creating_gem.html#releasing-the-gem |
| 54 | +[configured on RubyGems.org]: https://guides.rubygems.org/trusted-publishing/adding-a-publisher/ |
| 55 | +[trusted publishing]: https://guides.rubygems.org/trusted-publishing |
0 commit comments