Skip to content

Commit 3dd767c

Browse files
authored
Merge pull request #2683 from ViewComponent/release-4-13-0
Release 4 13 0
2 parents 875d77f + f37039c commit 3dd767c

15 files changed

Lines changed: 407 additions & 80 deletions
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Publish Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
pull-requests: read
11+
12+
jobs:
13+
publish:
14+
name: Publish release
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
pull-requests: read
19+
# Only run if this is a release commit (created by script/release)
20+
if: startsWith(github.event.head_commit.message, 'release ')
21+
steps:
22+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
23+
with:
24+
fetch-depth: 0
25+
token: ${{ secrets.GITHUB_TOKEN }}
26+
persist-credentials: false
27+
28+
- name: Set up Ruby
29+
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b
30+
with:
31+
bundler-cache: true
32+
33+
- name: Harden runner
34+
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c
35+
with:
36+
egress-policy: audit
37+
38+
- name: Configure git
39+
run: |
40+
git config user.name "github-actions[bot]"
41+
git config user.email "github-actions[bot]@users.noreply.github.com"
42+
43+
- name: Publish release
44+
env:
45+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
run: |
47+
script/publish

‎.github/workflows/release.yml‎

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
major:
7+
description: 'Major version'
8+
required: true
9+
type: string
10+
minor:
11+
description: 'Minor version'
12+
required: true
13+
type: string
14+
patch:
15+
description: 'Patch version'
16+
required: true
17+
type: string
18+
pre:
19+
description: 'Pre-release version (leave empty for release)'
20+
required: false
21+
type: string
22+
23+
permissions:
24+
contents: read
25+
pull-requests: read
26+
27+
jobs:
28+
validate-inputs:
29+
name: Validate version inputs
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Validate inputs are numeric
33+
env:
34+
MAJOR: ${{ inputs.major }}
35+
MINOR: ${{ inputs.minor }}
36+
PATCH: ${{ inputs.patch }}
37+
PRE: ${{ inputs.pre }}
38+
run: |
39+
if ! [[ "$MAJOR" =~ ^[0-9]+$ ]]; then
40+
echo "Error: major version must be numeric"
41+
exit 1
42+
fi
43+
if ! [[ "$MINOR" =~ ^[0-9]+$ ]]; then
44+
echo "Error: minor version must be numeric"
45+
exit 1
46+
fi
47+
if ! [[ "$PATCH" =~ ^[0-9]+$ ]]; then
48+
echo "Error: patch version must be numeric"
49+
exit 1
50+
fi
51+
if [ -n "$PRE" ] && ! [[ "$PRE" =~ ^[a-zA-Z0-9.-]+$ ]]; then
52+
echo "Error: pre-release version contains invalid characters"
53+
exit 1
54+
fi
55+
56+
prepare-release:
57+
name: Get current version
58+
needs: validate-inputs
59+
runs-on: ubuntu-latest
60+
outputs:
61+
current-major: ${{ steps.current-version.outputs.major }}
62+
current-minor: ${{ steps.current-version.outputs.minor }}
63+
current-patch: ${{ steps.current-version.outputs.patch }}
64+
current-pre: ${{ steps.current-version.outputs.pre }}
65+
steps:
66+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
67+
with:
68+
persist-credentials: false
69+
70+
- name: Read current version
71+
id: current-version
72+
run: |
73+
major=$(grep "MAJOR = " lib/view_component/version.rb | grep -o "[0-9]\+")
74+
minor=$(grep "MINOR = " lib/view_component/version.rb | grep -o "[0-9]\+")
75+
patch=$(grep "PATCH = " lib/view_component/version.rb | grep -o "[0-9]\+")
76+
pre=$(grep "PRE = " lib/view_component/version.rb | grep -o "\"[^\"]*\"" | tr -d '"')
77+
echo "major=$major" >> $GITHUB_OUTPUT
78+
echo "minor=$minor" >> $GITHUB_OUTPUT
79+
echo "patch=$patch" >> $GITHUB_OUTPUT
80+
echo "pre=$pre" >> $GITHUB_OUTPUT
81+
82+
- name: Show current version
83+
env:
84+
CURRENT_MAJOR: ${{ steps.current-version.outputs.major }}
85+
CURRENT_MINOR: ${{ steps.current-version.outputs.minor }}
86+
CURRENT_PATCH: ${{ steps.current-version.outputs.patch }}
87+
CURRENT_PRE: ${{ steps.current-version.outputs.pre }}
88+
INPUT_MAJOR: ${{ inputs.major }}
89+
INPUT_MINOR: ${{ inputs.minor }}
90+
INPUT_PATCH: ${{ inputs.patch }}
91+
INPUT_PRE: ${{ inputs.pre }}
92+
run: |
93+
current="$CURRENT_MAJOR.$CURRENT_MINOR.$CURRENT_PATCH"
94+
[ -n "$CURRENT_PRE" ] && current="$current-$CURRENT_PRE"
95+
echo "Current version: $current"
96+
release="$INPUT_MAJOR.$INPUT_MINOR.$INPUT_PATCH"
97+
[ -n "$INPUT_PRE" ] && release="$release-$INPUT_PRE"
98+
echo "Release version: $release"
99+
100+
release:
101+
name: Create release
102+
needs: [prepare-release, validate-inputs]
103+
runs-on: ubuntu-latest
104+
permissions:
105+
contents: write
106+
pull-requests: write
107+
steps:
108+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
109+
with:
110+
fetch-depth: 0
111+
token: ${{ secrets.GITHUB_TOKEN }}
112+
persist-credentials: false
113+
114+
- name: Set up Ruby
115+
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b
116+
with:
117+
bundler-cache: true
118+
119+
- name: Configure git
120+
run: |
121+
git config user.name "github-actions[bot]"
122+
git config user.email "github-actions[bot]@users.noreply.github.com"
123+
124+
- name: Create release
125+
env:
126+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
127+
MAJOR: ${{ inputs.major }}
128+
MINOR: ${{ inputs.minor }}
129+
PATCH: ${{ inputs.patch }}
130+
PRE: ${{ inputs.pre }}
131+
run: |
132+
script/release "$MAJOR" "$MINOR" "$PATCH" "$PRE"

‎Gemfile.lock‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
view_component (4.12.0)
4+
view_component (4.13.0)
55
actionview (>= 7.1.0)
66
activesupport (>= 7.1.0)
77
concurrent-ruby (~> 1)
@@ -346,7 +346,6 @@ GEM
346346
rubydex (0.3.0-arm64-darwin)
347347
rubydex (0.3.0-x86_64-darwin)
348348
rubydex (0.3.0-x86_64-linux)
349-
rubyzip (3.3.0)
350349
rubyzip (3.4.1)
351350
securerandom (0.4.1)
352351
selenium-webdriver (4.47.0)
@@ -610,7 +609,6 @@ CHECKSUMS
610609
rubydex (0.3.0-arm64-darwin) sha256=19f685610216e4e7f488722ac90dfbc33113a384dd16db309cf939606f4c32dd
611610
rubydex (0.3.0-x86_64-darwin) sha256=59d20c98b0bf2226f5db5bee14cf57075aa93aa0c3fa0176f496a217691ff7b6
612611
rubydex (0.3.0-x86_64-linux) sha256=dfe4026591f226b4a1b53f82f86dc14fad2e7c221ee8a5be99a0a46bf2d58b04
613-
rubyzip (3.3.0) sha256=a372fc67892a4f8c0bc8ec906b720353d8e48807a64b2e63adf99b1e3583a034
614612
rubyzip (3.4.1) sha256=0a79e745b5c25872ebd148457df5665da8530ed8626c993b01457128f173ca02
615613
securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
616614
selenium-webdriver (4.47.0) sha256=67f915b8223d2133bbaa13e92fd98854175394f086e2036a9eff4f5561fd69e4
@@ -646,7 +644,7 @@ CHECKSUMS
646644
unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
647645
uri (1.1.1) sha256=379fa58d27ffb1387eaada68c749d1426738bd0f654d812fcc07e7568f5c57c6
648646
useragent (0.16.11) sha256=700e6413ad4bb954bb63547fa098dddf7b0ebe75b40cc6f93b8d54255b173844
649-
view_component (4.12.0)
647+
view_component (4.13.0)
650648
warning (1.6.0) sha256=a49cdfae19fb77d19afff2efbe45f8ab759e9cd25b4e4ce2c79dbaf46bdb6c9e
651649
webrick (1.9.2) sha256=beb4a15fc474defed24a3bda4ffd88a490d517c9e4e6118c3edce59e45864131
652650
websocket (1.2.11) sha256=b7e7a74e2410b5e85c25858b26b3322f29161e300935f70a0e0d3c35e0462737

‎docs/CHANGELOG.md‎

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

1111
## main
1212

13+
## 4.13.0
14+
1315
* Add support for Turbo-streaming ViewComponents.
1416

1517
*Ben Sheldon*, *Joel Hawksley*

‎docs/CONTRIBUTING.md‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,26 @@ To run the Vale prose linter locally, `brew install vale` and `vale docs/`.
113113

114114
## Releasing
115115

116-
`./script/release`
116+
Releases are automated using GitHub Actions. Here's the process:
117+
118+
1. Go to **Actions** → **Release** → **Run workflow**
119+
2. Enter the new version numbers (current values are pre-filled):
120+
- **major**: Major version number
121+
- **minor**: Minor version number
122+
- **patch**: Patch version number
123+
- **pre**: Optional pre-release label (leave blank for stable release)
124+
3. Click **Run workflow**
125+
4. The workflow will:
126+
- Create a release branch
127+
- Update version files and changelog
128+
- Update dependencies
129+
- Open a pull request
130+
5. Review and merge the pull request to main
131+
6. After merge, the workflow automatically:
132+
- Publishes docs to gh-pages
133+
- Creates a GitHub release
134+
- Pushes the tag to trigger gem publishing
135+
7. The gem is published to RubyGems automatically via GitHub Actions (requires approval from a maintainer in the "release" environment)
117136

118137
## Governance
119138

‎docs/_data/library.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version: 4.12.0
1+
version: 4.13.0

‎gemfiles/rails_7.1.gemfile.lock‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: ..
33
specs:
4-
view_component (4.12.0)
4+
view_component (4.13.0)
55
actionview (>= 7.1.0)
66
activesupport (>= 7.1.0)
77
concurrent-ruby (~> 1)
@@ -151,6 +151,7 @@ GEM
151151
temple (>= 0.8.2)
152152
thor
153153
tilt
154+
herb (0.8.2)
154155
herb (0.8.2-aarch64-linux-gnu)
155156
herb (0.8.2-aarch64-linux-musl)
156157
herb (0.8.2-arm-linux-gnu)
@@ -189,6 +190,7 @@ GEM
189190
matrix (0.4.3)
190191
method_source (1.1.0)
191192
mini_mime (1.1.5)
193+
mini_portile2 (2.8.9)
192194
minitest (6.0.6)
193195
drb (~> 2.0)
194196
prism (~> 1.5)
@@ -209,6 +211,9 @@ GEM
209211
net-smtp (0.5.1)
210212
net-protocol
211213
nio4r (2.7.5)
214+
nokogiri (1.19.3)
215+
mini_portile2 (~> 2.8.2)
216+
racc (~> 1.4)
212217
nokogiri (1.19.3-aarch64-linux-gnu)
213218
racc (~> 1.4)
214219
nokogiri (1.19.3-aarch64-linux-musl)
@@ -480,7 +485,7 @@ DEPENDENCIES
480485
yard-lint (~> 1.5)
481486

482487
RUBY VERSION
483-
ruby 3.2.8p263
488+
ruby 3.2.8p263
484489

485490
BUNDLED WITH
486-
2.6.2
491+
4.1.0.dev

‎gemfiles/rails_7.2.gemfile.lock‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: ..
33
specs:
4-
view_component (4.12.0)
4+
view_component (4.13.0)
55
actionview (>= 7.1.0)
66
activesupport (>= 7.1.0)
77
concurrent-ruby (~> 1)
@@ -145,6 +145,7 @@ GEM
145145
temple (>= 0.8.2)
146146
thor
147147
tilt
148+
herb (0.8.2)
148149
herb (0.8.2-aarch64-linux-gnu)
149150
herb (0.8.2-aarch64-linux-musl)
150151
herb (0.8.2-arm-linux-gnu)
@@ -183,6 +184,7 @@ GEM
183184
matrix (0.4.3)
184185
method_source (1.1.0)
185186
mini_mime (1.1.5)
187+
mini_portile2 (2.8.9)
186188
minitest (6.0.6)
187189
drb (~> 2.0)
188190
prism (~> 1.5)
@@ -202,6 +204,9 @@ GEM
202204
net-smtp (0.5.1)
203205
net-protocol
204206
nio4r (2.7.5)
207+
nokogiri (1.19.3)
208+
mini_portile2 (~> 2.8.2)
209+
racc (~> 1.4)
205210
nokogiri (1.19.3-aarch64-linux-gnu)
206211
racc (~> 1.4)
207212
nokogiri (1.19.3-aarch64-linux-musl)
@@ -473,7 +478,7 @@ DEPENDENCIES
473478
yard-lint (~> 1.5)
474479

475480
RUBY VERSION
476-
ruby 3.3.8p144
481+
ruby 3.3.8p144
477482

478483
BUNDLED WITH
479-
2.6.2
484+
4.1.0.dev

‎gemfiles/rails_8.0.gemfile.lock‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: ..
33
specs:
4-
view_component (4.12.0)
4+
view_component (4.13.0)
55
actionview (>= 7.1.0)
66
activesupport (>= 7.1.0)
77
concurrent-ruby (~> 1)
@@ -142,6 +142,7 @@ GEM
142142
temple (>= 0.8.2)
143143
thor
144144
tilt
145+
herb (0.8.2)
145146
herb (0.8.2-aarch64-linux-gnu)
146147
herb (0.8.2-aarch64-linux-musl)
147148
herb (0.8.2-arm-linux-gnu)
@@ -180,6 +181,7 @@ GEM
180181
matrix (0.4.3)
181182
method_source (1.1.0)
182183
mini_mime (1.1.5)
184+
mini_portile2 (2.8.9)
183185
minitest (6.0.6)
184186
drb (~> 2.0)
185187
prism (~> 1.5)
@@ -199,6 +201,9 @@ GEM
199201
net-smtp (0.5.1)
200202
net-protocol
201203
nio4r (2.7.5)
204+
nokogiri (1.19.3)
205+
mini_portile2 (~> 2.8.2)
206+
racc (~> 1.4)
202207
nokogiri (1.19.3-aarch64-linux-gnu)
203208
racc (~> 1.4)
204209
nokogiri (1.19.3-aarch64-linux-musl)
@@ -470,7 +475,7 @@ DEPENDENCIES
470475
yard-lint (~> 1.5)
471476

472477
RUBY VERSION
473-
ruby 3.4.4p34
478+
ruby 3.4.4p34
474479

475480
BUNDLED WITH
476-
2.6.9
481+
4.1.0.dev

0 commit comments

Comments
 (0)