Skip to content

Commit 8f5073e

Browse files
committed
Separate gem release workflow into three steps
1. Bump the gem version (manually triggered) 2. Release the gem to rubygems.org (manually triggered); this also creates and pushes a new GitHub tag 3. Create and publish a new GitHub release (automatically triggered by tag push)
1 parent 95205dc commit 8f5073e

File tree

3 files changed

+75
-19
lines changed

3 files changed

+75
-19
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Create GitHub Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
create-release:
10+
name: Create GitHub Release
11+
runs-on: ubuntu-latest
12+
13+
permissions:
14+
contents: write
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
19+
20+
- name: Create GitHub release
21+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
22+
with:
23+
github-token: ${{ secrets.GITHUB_TOKEN }}
24+
script: |
25+
await github.rest.repos.createRelease({
26+
owner: context.repo.owner,
27+
repo: context.repo.repo,
28+
tag_name: "${{ github.ref }}",
29+
name: "${{ github.ref_name }}",
30+
generate_release_notes: true
31+
})

.github/workflows/release.yml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,3 @@ jobs:
2828

2929
- name: Release gem on RubyGems.org
3030
uses: rubygems/release-gem@1c162a739e8b4cb21a676e97b087e8268d8fc40b # v1.1.2
31-
32-
- name: Get latest tag
33-
id: get_tag
34-
run: |
35-
TAG=$(git describe --tags --abbrev=0)
36-
echo "tag=$TAG" >> $GITHUB_OUTPUT
37-
38-
- name: Create GitHub release
39-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
40-
with:
41-
github-token: "${{ secrets.GITHUB_TOKEN }}"
42-
script: |
43-
await github.rest.repos.createRelease({
44-
owner: context.repo.owner,
45-
repo: context.repo.repo,
46-
tag_name: "refs/tags/${{ steps.get_tag.outputs.tag }}",
47-
name: "${{ steps.get_tag.outputs.tag }}",
48-
generate_release_notes: true
49-
})

.github/workflows/version-bump.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Bump version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'New version number (e.g., 0.3.9)'
8+
required: true
9+
type: string
10+
11+
jobs:
12+
bump-version:
13+
name: Bump version to ${{ inputs.version }}
14+
runs-on: ubuntu-latest
15+
16+
permissions:
17+
contents: write
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
22+
with:
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Set up Ruby
26+
uses: ruby/setup-ruby@8aeb6ff8030dd539317f8e1769a044873b56ea71 # v1.268.0
27+
with:
28+
bundler-cache: false
29+
30+
- name: Update version.rb
31+
run: |
32+
sed -i 's/VERSION = .*/VERSION = "${{ inputs.version }}"/' lib/rbi/version.rb
33+
cat lib/rbi/version.rb
34+
35+
- name: Bundle install
36+
run: bundle install
37+
38+
- name: Commit version bump
39+
run: |
40+
git config user.name "github-actions[bot]"
41+
git config user.email "github-actions[bot]@users.noreply.github.com"
42+
git add lib/rbi/version.rb Gemfile.lock
43+
git commit -m "Bump to v${{ inputs.version }}"
44+
git push

0 commit comments

Comments
 (0)