Skip to content

Commit 2d96c9b

Browse files
authored
Merge pull request #381 from rubygems/doc
Improve documentation for role-to-assume
2 parents fb7041d + 58573a2 commit 2d96c9b

File tree

1 file changed

+37
-24
lines changed

1 file changed

+37
-24
lines changed

README.md

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ and exports environment variables used by both `rubygems` and
1616
<!-- toc -->
1717

1818
- [Usage](#usage)
19-
- [Examples](#examples)
20-
- [OIDC (recommended)](#oidc-recommended)
21-
- [Static API token in repository secrets](#static-api-token-in-repository-secrets)
19+
- [Trusted Publisher (recommended)](#trusted-publisher-recommended)
20+
- [OIDC API Key Role](#oidc-api-key-role)
21+
- [Static API token in repository secrets](#static-api-token-in-repository-secrets)
2222
- [Use with the RubyGems CLI](#use-with-the-rubygems-cli)
2323
- [License Summary](#license-summary)
2424
- [Security Disclosures](#security-disclosures)
@@ -27,11 +27,39 @@ and exports environment variables used by both `rubygems` and
2727

2828
## Usage
2929

30-
We recommend that
31-
you use GitHub's OIDC provider in conjunction with a configured
32-
RubyGems OIDC API Key Role.
30+
There are three ways to configure RubyGems credentials:
3331

34-
To do that, you would add the following step to your workflow:
32+
1. **Trusted Publisher (recommended)**: Uses OIDC without any API tokens or secrets.
33+
2. **OIDC API Key Role**: Uses OIDC with a pre-configured API Key Role on RubyGems.org.
34+
3. **Static API token**: Uses a RubyGems API token stored in repository secrets.
35+
36+
> **Note**: The OIDC-based configurations (**Trusted Publisher** and **OIDC API Key Role**) require the `id-token: write` permission in your workflow, for example:
37+
>
38+
> ```yaml
39+
> permissions:
40+
> id-token: write
41+
> contents: read
42+
> ```
43+
44+
### Trusted Publisher (recommended)
45+
46+
The simplest approach is to use [Trusted Publishing](https://guides.rubygems.org/trusted-publishing/).
47+
Configure a trusted publisher for your gem on RubyGems.org, then use:
48+
49+
```yaml
50+
- name: Configure RubyGems Credentials
51+
uses: rubygems/configure-rubygems-credentials@main
52+
```
53+
54+
No additional inputs are required. The action will automatically use OIDC to authenticate
55+
with RubyGems.org as a trusted publisher.
56+
57+
### OIDC API Key Role
58+
59+
Alternatively, you can create an OIDC API Key Role on RubyGems.org and reference it
60+
with the `role-to-assume` input. The value is the **OIDC API Key Role token**
61+
(a string starting with `rg_oidc_akr_`), which you can find on the
62+
"OIDC: Create" page of your gem on RubyGems.org.
3563
3664
```yaml
3765
- name: Configure RubyGems Credentials
@@ -58,9 +86,7 @@ jobs:
5886
steps:
5987
- uses: rubygems/configure-rubygems-credentials@main
6088
with:
61-
role-to-assume: 2
62-
gem-server: 'https://oidc-api-token.rubygems.org'
63-
audience: 'https://oidc-api-token.rubygems.org'
89+
role-to-assume: rg_oidc_akr_f55fe1127adjkkcn8ty6
6490
- uses: actions/checkout@v3
6591
- name: Set remote URL
6692
run: |
@@ -79,20 +105,7 @@ jobs:
79105
See [action.yml](action.yml) for the full documentation for this action's inputs
80106
and outputs.
81107
82-
### Examples
83-
84-
#### OIDC (recommended)
85-
86-
```yaml
87-
- name: Configure RubyGems Credentials
88-
uses: rubygems/configure-rubygems-credentials@main
89-
with:
90-
role-to-assume: 3
91-
```
92-
93-
In this example, the Action will load the OIDC token from the GitHub-provided environment variable and use it to assume the role `3`.
94-
95-
#### Static API token in repository secrets
108+
### Static API token in repository secrets
96109
97110
```yaml
98111
- name: Configure RubyGems Credentials

0 commit comments

Comments
 (0)