Skip to content

Commit 570c783

Browse files
ci: release gems from CI instead of manually
1 parent fb4a4e8 commit 570c783

File tree

2 files changed

+78
-11
lines changed

2 files changed

+78
-11
lines changed

.github/workflows/build-gems.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@ name: Build gems
22
on:
33
push:
44
branches: [main]
5-
tags: ["*"]
65
paths-ignore:
76
- "*.md"
87
- "docs/**"
98
pull_request:
9+
workflow_call:
10+
inputs:
11+
publish:
12+
type: boolean
13+
default: false
14+
ref:
15+
type: string
16+
required: true
1017

1118
jobs:
1219
ci-data:
@@ -32,6 +39,8 @@ jobs:
3239
ruby-platform: ${{ fromJSON(needs.ci-data.outputs.result).supported-ruby-platforms }}
3340
steps:
3441
- uses: actions/checkout@v6
42+
with:
43+
ref: ${{ inputs.ref || github.ref }}
3544

3645
- uses: ruby/setup-ruby@v1
3746
with:
@@ -48,3 +57,9 @@ jobs:
4857
name: cross-gem-${{ matrix.ruby-platform }}
4958
path: ${{ steps.cross-gem.outputs.gem-path }}
5059
if-no-files-found: error
60+
61+
- uses: rubygems/configure-rubygems-credentials@v1.0.0
62+
if: ${{ inputs.publish }}
63+
64+
- run: gem push "${{ steps.cross-gem.outputs.gem-path }}"
65+
if: ${{ inputs.publish }}

.github/workflows/release.yml

Lines changed: 62 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,22 @@ on:
66
inputs:
77
tag-name:
88
type: string
9-
description: "Nightly release tag"
9+
description: "Release tag"
1010
required: true
11+
type:
12+
type: choice
13+
description: "Release type"
14+
required: true
15+
options:
16+
- "nightly"
17+
- "stable"
18+
1119
push:
1220
tags: ["*"]
1321

1422
jobs:
15-
create-nightly-tag:
16-
if: ${{ github.event_name != 'push' }}
23+
create-tag:
24+
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
1725
runs-on: ubuntu-24.04
1826
permissions:
1927
contents: write
@@ -29,31 +37,75 @@ jobs:
2937
run: |
3038
MANUAL_TAG="${{ inputs.tag-name }}"
3139
echo "TAG_NAME=${MANUAL_TAG:-$(date +'%Y-%m-%d')-a}" >> $GITHUB_OUTPUT
40+
- run: rake 'bump_version[${{ steps.generate-tag.outputs.TAG_NAME }}]'
41+
if: ${{ inputs.type == 'stable' }}
42+
- run: git commit -am "Release ${{ steps.generate-tag.outputs.TAG_NAME }}"
43+
if: ${{ inputs.type == 'stable' }}
3244
- run: git tag "${{ steps.generate-tag.outputs.TAG_NAME }}"
3345
- run: git push origin "${{ steps.generate-tag.outputs.TAG_NAME }}"
3446

35-
release-nightly:
36-
if: ${{ github.event_name != 'push' }}
47+
# For nightly releases, we just build and publish npm packages
48+
release-nightly-npm-packages:
49+
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'nightly') }}
3750
needs:
38-
- create-nightly-tag
51+
- create-tag
3952
permissions:
4053
contents: write
4154
id-token: write
4255
packages: write
4356
uses: ./.github/workflows/build.yml
4457
with:
4558
publish: true
46-
prerel_name: ${{ needs.create-nightly-tag.outputs.tag-name }}
59+
prerel_name: ${{ needs.create-tag.outputs.tag-name }}
4760
secrets: inherit
4861

49-
release-tag:
50-
if: ${{ github.event_name == 'push' && github.actor != 'github-actions[bot]' }}
62+
# For stable releases, we build and publish npm packages, ruby_wasm gem, and js gem
63+
release-tag-npm-packages:
64+
if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'stable') }}
65+
needs:
66+
- create-tag
5167
permissions:
5268
contents: write
5369
id-token: write
5470
packages: write
5571
uses: ./.github/workflows/build.yml
5672
with:
5773
publish: true
58-
prerel_name: ${{ github.ref_name }}
74+
prerel_name: ${{ needs.create-tag.outputs.tag-name || github.ref_name }}
5975
secrets: inherit
76+
77+
release-tag-ruby_wasm-gem:
78+
if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'stable') }}
79+
needs:
80+
- create-tag
81+
permissions:
82+
contents: write
83+
id-token: write
84+
packages: write
85+
uses: ./.github/workflows/build-gems.yml
86+
with:
87+
publish: true
88+
ref: ${{ needs.create-tag.outputs.tag-name || github.ref_name }}
89+
secrets: inherit
90+
91+
release-tag-js-gem:
92+
if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'stable') }}
93+
runs-on: ubuntu-24.04
94+
needs:
95+
- create-tag
96+
permissions:
97+
contents: write
98+
id-token: write
99+
packages: write
100+
steps:
101+
- uses: actions/checkout@v6
102+
with:
103+
ref: ${{ needs.create-tag.outputs.tag-name || github.ref_name }}
104+
- uses: ruby/setup-ruby@v1
105+
with:
106+
ruby-version: "3.4"
107+
- uses: rubygems/configure-rubygems-credentials@v1.0.0
108+
- run: |
109+
cd packages/gems/js
110+
gem build
111+
gem push js-*.gem

0 commit comments

Comments
 (0)