Skip to content

Commit 6a33362

Browse files
authored
Merge pull request #2405 from ViewComponent/2224-setup-trusted-publishing
Setup Trusted Publishing
2 parents 25f2c58 + 40bde33 commit 6a33362

File tree

4 files changed

+46
-2
lines changed

4 files changed

+46
-2
lines changed

.github/workflows/push_gem.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Push Gem
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
push:
13+
if: github.repository == 'ViewComponent/view_component'
14+
runs-on: ubuntu-latest
15+
16+
permissions:
17+
contents: write
18+
id-token: write
19+
20+
# GitHub environment configured on RubyGems
21+
environment: release
22+
23+
steps:
24+
# Set up
25+
- name: Harden Runner
26+
uses: step-security/harden-runner@v2
27+
with:
28+
egress-policy: audit
29+
30+
- uses: actions/checkout@v4
31+
- name: Set up Ruby
32+
uses: ruby/setup-ruby@v1
33+
with:
34+
bundler-cache: true
35+
ruby-version: ruby
36+
37+
# Release
38+
- uses: rubygems/release-gem@v1

docs/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ nav_order: 6
1010

1111
## main
1212

13+
* Setup Trusted Publishing to RubyGems to improve software supply chain safety.
14+
15+
*Hans Lemuet*
16+
1317
## 4.0.0
1418

1519
Two years after releasing [3.0.0](https://github.com/ViewComponent/view_component/releases/tag/v3.0.0) and almost six years since [1.0.0](https://github.com/ViewComponent/view_component/releases/tag/v1.0.0), we're proud to ship ViewComponent 4. This release marks a shift towards a Long Term Support model for the project, having reached significant feature maturity. While contributions are always welcome, we're unlikely to accept further breaking changes or major feature additions.

script/publish

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

33
# Publish gem
4-
bundle exec rake release
4+
# this step has been replaced by .github/workflows/push_gem.yml
55

66
# Publish updated docs
77
git branch -D gh-pages

script/release

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ push() {
8282

8383
echo "####################################################"
8484
echo "Now, open a PR with this branch and merge it to main"
85-
echo "Then, run script/publish on main to release the gem"
85+
echo "Then, run script/publish on main to publish the docs"
86+
echo "The gem will be pushed to RubyGems automatically by"
87+
echo "Github Actions, using Trusted Publishing."
8688
echo "Finally, create a GitHub release https://github.com/viewcomponent/view_component/releases/new with the changes from docs/CHANGELOG"
8789
echo "####################################################"
8890
}

0 commit comments

Comments
 (0)