Skip to content

Commit 85db3a9

Browse files
committed
Add push_gem workflow, update docs & scripts
1 parent 5e06b55 commit 85db3a9

File tree

4 files changed

+44
-2
lines changed

4 files changed

+44
-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/CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ To run the Vale prose linter locally, `brew install vale` and `vale docs/`.
9898

9999
`./script/release`
100100

101+
To improve software supply chain safety, new gem versions are automatically pushed to RubyGems by Github Actions, thanks to [Trusted Publishing](https://guides.rubygems.org/trusted-publishing/).
102+
101103
## Governance
102104

103105
ViewComponent is built by over a hundred members of the community. Project membership has several levels:

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)