Skip to content

Commit c93109b

Browse files
committed
Document reusable workflow support for trusted publishing
Add documentation for the new Workflow Repository Owner and Workflow Repository Name fields that enable trusted publishing with reusable workflows from different repositories.
1 parent 4380a4e commit c93109b

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

trusted-publishing/adding-a-publisher.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,30 @@ If you have multiple workflows that push gems, you can create one Trusted Publis
3030
The environment allows GitHub to constrain who can publish your gem if many people have access to the repository.
3131
We suggest using the [GitHub Action Environment](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/using-environments-for-deploymentenvironment) name "release", which we will use in our workflow examples on the next page.
3232

33+
### Using reusable workflows
34+
35+
If your release workflow uses a [reusable workflow](https://docs.github.com/en/actions/sharing-automations/reusing-workflows) from a different repository, you'll need to configure the optional "Workflow Repository" fields.
36+
37+
When a workflow calls a reusable workflow from another repository, the OIDC token's `job_workflow_ref` claim points to the reusable workflow's location, not the calling repository's workflow. The "Workflow Repository Owner" and "Workflow Repository Name" fields tell RubyGems.org where the actual workflow file lives.
38+
39+
For example, if your gem's repository (`my-org/my-gem`) calls a shared release workflow from `shared-org/shared-workflows`:
40+
41+
```yaml
42+
# In my-org/my-gem/.github/workflows/release.yml
43+
jobs:
44+
release:
45+
uses: shared-org/shared-workflows/.github/workflows/ruby-gem-release.yml@main
46+
```
47+
48+
You would configure the trusted publisher with:
49+
- **Repository owner**: `my-org`
50+
- **Repository name**: `my-gem`
51+
- **Workflow filename**: `ruby-gem-release.yml`
52+
- **Workflow Repository Owner**: `shared-org`
53+
- **Workflow Repository Name**: `shared-workflows`
54+
55+
Leave the Workflow Repository fields blank if your workflow file is in the same repository as your gem.
56+
3357
Once you click "Create Rubygem trusted publisher", your publisher will be registered and will appear in the list of trusted publishers for this gem.
3458

3559
![List of configured gem trusted publishers](/images/trusted-publishing/rubygem-trusted-publishers-index.png){:class="t-img"}

trusted-publishing/pushing-a-new-gem.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ For example, if you have a repository at `https://github.com/rubygems/sample-gem
2929

3030
![Pending trusted publisher creation form with values filled in](/images/trusted-publishing/pending-trusted-publisher-form-filled.png){:class="t-img"}
3131

32+
If your workflow uses a reusable workflow from another repository, you'll also need to fill in the optional "Workflow Repository Owner" and "Workflow Repository Name" fields. See [Using reusable workflows](/trusted-publishing/adding-a-publisher#using-reusable-workflows) for details.
33+
3234
Once you click "Create Pending trusted publisher", your publisher will be registered and will appear in the list of pending publishers for your account.
3335

3436
![List of configured pending trusted publishers](/images/trusted-publishing/pending-trusted-publishers-index.png){:class="t-img"}

0 commit comments

Comments
 (0)