Skip to content

Commit 4834e00

Browse files
authored
chore: Upgrade release system to the toys-release gem (#2006)
1 parent 1d70fe4 commit 4834e00

File tree

10 files changed

+90
-103
lines changed

10 files changed

+90
-103
lines changed

.github/workflows/release-hook-on-closed.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@ jobs:
1515
pull-requests: write # required for updating label on PR, posting comments
1616
issues: write # required for creating new issues on failed releases
1717
runs-on: ubuntu-latest
18+
env:
19+
BUNDLE_GEMFILE: ${{ github.workspace }}/.toys/release/Gemfile
1820
steps:
21+
- name: Checkout repo
22+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1923
- name: Install Ruby
2024
uses: ruby/setup-ruby@8d27f39a5e7ad39aebbcbd1324f7af020229645c # v1.287.0
2125
with:
22-
ruby-version: 3.1
23-
- name: Checkout repo
24-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
25-
- name: Install Toys
26-
run: "gem install --no-document toys -v 0.15.5"
26+
ruby-version: "4.0"
27+
bundler-cache: true
2728
- name: Process release request
2829
env:
2930
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
3032
run: |
31-
toys release _onclosed --verbose \
32-
"--enable-releases=${{ secrets.ENABLE_RELEASES }}" \
33+
bundle exec toys release _onclosed --verbose \
3334
"--event-path=${{ github.event_path }}" \
34-
"--rubygems-api-key=${{ secrets.RUBYGEMS_API_KEY }}" \
3535
< /dev/null

.github/workflows/release-hook-on-push.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,19 @@ jobs:
1515
contents: write # required for pushing changes
1616
pull-requests: write # required for updating open release PRs
1717
runs-on: ubuntu-latest
18+
env:
19+
BUNDLE_GEMFILE: ${{ github.workspace }}/.toys/release/Gemfile
1820
steps:
21+
- name: Checkout repo
22+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1923
- name: Install Ruby
2024
uses: ruby/setup-ruby@8d27f39a5e7ad39aebbcbd1324f7af020229645c # v1.287.0
2125
with:
22-
ruby-version: 3.1
23-
- name: Checkout repo
24-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
25-
- name: Install Toys
26-
run: "gem install --no-document toys -v 0.15.5"
26+
ruby-version: "4.0"
27+
bundler-cache: true
2728
- name: Update open releases
2829
env:
2930
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3031
run: |
31-
toys release _onpush --verbose \
32+
bundle exec toys release _onpush --verbose \
3233
< /dev/null

.github/workflows/release-perform.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: Force release
33
on:
44
workflow_dispatch:
55
inputs:
6-
gem:
7-
description: Gem to release
6+
name:
7+
description: Component to release
88
required: true
99
version:
1010
description: Version to release
@@ -22,24 +22,26 @@ jobs:
2222
if: ${{ github.repository == 'open-telemetry/opentelemetry-ruby' }}
2323
permissions:
2424
contents: write # required for creating releases
25+
pull-requests: write # required for updating label on PR, posting comments
26+
issues: write # required for creating new issues on failed releases
2527
runs-on: ubuntu-latest
28+
env:
29+
BUNDLE_GEMFILE: ${{ github.workspace }}/.toys/release/Gemfile
2630
steps:
31+
- name: Checkout repo
32+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2733
- name: Install Ruby
2834
uses: ruby/setup-ruby@8d27f39a5e7ad39aebbcbd1324f7af020229645c # v1.287.0
2935
with:
30-
ruby-version: 3.1
31-
- name: Checkout repo
32-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
33-
- name: Install Toys
34-
run: "gem install --no-document toys -v 0.15.5"
36+
ruby-version: "4.0"
37+
bundler-cache: true
3538
- name: Perform release
3639
env:
3740
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
3842
run: |
39-
toys release perform --yes --verbose \
40-
"--enable-releases=${{ secrets.ENABLE_RELEASES }}" \
41-
"--release-sha=${{ github.sha }}" \
42-
"--rubygems-api-key=${{ secrets.RUBYGEMS_API_KEY }}" \
43+
bundle exec toys release perform --yes --verbose \
44+
"--release-ref=${{ github.sha }}" \
4345
${{ github.event.inputs.flags }} \
44-
"${{ github.event.inputs.gem }}" "${{ github.event.inputs.version }}" \
46+
"${{ github.event.inputs.name }}" "${{ github.event.inputs.version }}" \
4547
< /dev/null

.github/workflows/release-request-weekly.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@ jobs:
1414
contents: write # required for pushing changes
1515
pull-requests: write # required for creating release PRs
1616
runs-on: ubuntu-latest
17+
env:
18+
BUNDLE_GEMFILE: ${{ github.workspace }}/.toys/release/Gemfile
1719
steps:
20+
- name: Checkout repo
21+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1822
- name: Install Ruby
1923
uses: ruby/setup-ruby@8d27f39a5e7ad39aebbcbd1324f7af020229645c # v1.287.0
2024
with:
21-
ruby-version: 3.1
22-
- name: Checkout repo
23-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
24-
- name: Install Toys
25-
run: "gem install --no-document toys -v 0.15.5"
25+
ruby-version: "4.0"
26+
bundler-cache: true
2627
- name: Create otelbot app token
2728
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
2829
id: app-token
@@ -34,6 +35,6 @@ jobs:
3435
# Use an app token instead of GITHUB_TOKEN to trigger workflows
3536
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
3637
run: |
37-
toys release request --yes --verbose \
38-
"--release-ref=${{ github.ref }}" \
38+
bundle exec toys release request --yes --verbose \
39+
"--target-branch=${{ github.ref }}" \
3940
< /dev/null

.github/workflows/release-request.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: Open release request
33
on:
44
workflow_dispatch:
55
inputs:
6-
gems:
7-
description: Gems to release (leave blank to release all gems)
6+
names:
7+
description: Components to release (leave blank to release all components)
88
required: false
99
default: ""
1010

@@ -18,15 +18,16 @@ jobs:
1818
contents: write # required for pushing changes
1919
pull-requests: write # required for creating release PRs
2020
runs-on: ubuntu-latest
21+
env:
22+
BUNDLE_GEMFILE: ${{ github.workspace }}/.toys/release/Gemfile
2123
steps:
24+
- name: Checkout repo
25+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2226
- name: Install Ruby
2327
uses: ruby/setup-ruby@8d27f39a5e7ad39aebbcbd1324f7af020229645c # v1.287.0
2428
with:
25-
ruby-version: 3.1
26-
- name: Checkout repo
27-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
28-
- name: Install Toys
29-
run: "gem install --no-document toys -v 0.15.5"
29+
ruby-version: "4.0"
30+
bundler-cache: true
3031
- name: Create otelbot app token
3132
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
3233
id: app-token
@@ -38,7 +39,7 @@ jobs:
3839
# Use an app token instead of GITHUB_TOKEN to trigger workflows
3940
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
4041
run: |
41-
toys release request --yes --verbose \
42-
"--gems=${{ github.event.inputs.gems }}" \
43-
"--release-ref=${{ github.ref }}" \
42+
bundle exec toys release request --yes --verbose \
43+
"--target-branch=${{ github.ref }}" \
44+
${{ github.event.inputs.names }} \
4445
< /dev/null

.github/workflows/release-retry.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,25 @@ jobs:
1919
if: ${{ github.repository == 'open-telemetry/opentelemetry-ruby' }}
2020
permissions:
2121
contents: write # required for creating releases
22-
pull-requests: write # required for updating open release PRs
22+
pull-requests: write # required for updating label on PR, posting comments
2323
issues: write # required for creating new issues on failed releases
2424
runs-on: ubuntu-latest
25+
env:
26+
BUNDLE_GEMFILE: ${{ github.workspace }}/.toys/release/Gemfile
2527
steps:
28+
- name: Checkout repo
29+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2630
- name: Install Ruby
2731
uses: ruby/setup-ruby@8d27f39a5e7ad39aebbcbd1324f7af020229645c # v1.287.0
2832
with:
29-
ruby-version: 3.1
30-
- name: Checkout repo
31-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
32-
- name: Install Toys
33-
run: "gem install --no-document toys -v 0.15.5"
33+
ruby-version: "4.0"
34+
bundler-cache: true
3435
- name: Retry release
3536
env:
3637
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
3739
run: |
38-
toys release retry --yes --verbose \
39-
"--enable-releases=${{ secrets.ENABLE_RELEASES }}" \
40-
"--rubygems-api-key=${{ secrets.RUBYGEMS_API_KEY }}" \
40+
bundle exec toys release retry --yes --verbose \
4141
${{ github.event.inputs.flags }} \
4242
"${{ github.event.inputs.release_pr }}" \
4343
< /dev/null

.toys/.data/releases.yml

Lines changed: 18 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,87 @@
1-
# This file controls the release system.
1+
# This file controls the toys-release gem.
22

33
# The repo organization and name.
44
repo: open-telemetry/opentelemetry-ruby
5-
# The main branch name. Releases must happen on this branch.
6-
main_branch: main
7-
# Time in seconds for release scripts to wait for CI to complete.
8-
required_checks_timeout: 1200
5+
6+
# Disable pre-release GitHub check requirements.
7+
required_checks: false
8+
9+
# If commits are added when release pull requests are open, update those pull
10+
# requests to reflect the new commits.
11+
update_existing_requests: true
12+
913
# Git user attached to commits for release pull requests.
1014
git_user_name: otelbot
1115
git_user_email: 197425009+otelbot@users.noreply.github.com
12-
# Toys tool that builds YARD reference docs
13-
docs_builder_tool: [yardoc]
14-
15-
# Control the conventional commit linter.
16-
commit_lint:
17-
# Whether conventional commit errors should cause a GitHub check fail.
18-
fail_checks: true
19-
# Merge types allowed by the repo.
20-
merge: squash
2116

2217
# List of all releasable gems. Each gem should include:
2318
# * name: The name of the gem. (Required.)
24-
# * directory: Gem directory relative to the repo root. (Required.)
19+
# * directory: Gem directory relative to the repo root.
20+
# (Required unless the gem name matches the directory name exactly. This
21+
# means it's always required in this repo because all the gem names include
22+
# the word "opentelemetry" whereas the directory names do not.)
2523
# * version_rb_path: Path to version.rb relative to the gem directory.
2624
# (Required only if it does not match the gem name. e.g. The gem
27-
# "opentelemetry-sdk" would default to lib/opentelemetry/sdk/version.rb)
28-
# * version_constant: The fully-qualified version constant as an array.
29-
# (Required because the OpenTelemetry namespace does not match the gem
30-
# name "opentelemetry".)
25+
# "opentelemetry-sdk" would default to "lib/opentelemetry/sdk/version.rb",
26+
# so this field is required only if the actual path is different.)
3127
# * changelog_path: Path to CHANGELOG.md relative to the gem directory.
32-
# (Required only if it is not in the expected location.)
28+
# (Required only if it is not in the expected location, which is the file
29+
# "CHANGELOG.md" at the root of the gem directory.)
3330
gems:
3431
- name: opentelemetry-api
3532
directory: api
3633
version_rb_path: lib/opentelemetry/version.rb
37-
version_constant: [OpenTelemetry, VERSION]
3834

3935
- name: opentelemetry-registry
4036
directory: registry
4137
version_rb_path: lib/opentelemetry/instrumentation/registry/version.rb
42-
version_constant: [OpenTelemetry, Instrumentation, Registry, VERSION]
4338

4439
- name: opentelemetry-sdk
4540
directory: sdk
46-
version_constant: [OpenTelemetry, SDK, VERSION]
4741

4842
- name: opentelemetry-sdk-experimental
4943
directory: sdk_experimental
50-
version_rb_path: lib/opentelemetry/sdk/experimental/version.rb
51-
version_constant: [OpenTelemetry, SDK, Experimental, VERSION]
5244

5345
- name: opentelemetry-common
5446
directory: common
55-
version_rb_path: lib/opentelemetry/common/version.rb
56-
version_constant: [OpenTelemetry, Common, VERSION]
5747

5848
- name: opentelemetry-exporter-otlp
59-
# we append a slash here to avoid the naive substring start_with? directory-matching condition in underlying toys gem
60-
# which causes exporter/otlp to incorrectly match when changes occur in exporter/otlp-logs or exporter/otlp-metrics
61-
# https://github.com/dazuma/toys/blob/17ed449da8299f272b834470ff6b279a59e8070b/.toys/release/.lib/release_utils.rb#L436
62-
# https://github.com/open-telemetry/opentelemetry-ruby/issues/1792
63-
directory: exporter/otlp/
64-
version_constant: [OpenTelemetry, Exporter, OTLP, VERSION]
49+
directory: exporter/otlp
6550

6651
- name: opentelemetry-exporter-otlp-logs
6752
directory: exporter/otlp-logs
68-
version_constant: [OpenTelemetry, Exporter, OTLP, Logs, VERSION]
6953

7054
- name: opentelemetry-exporter-otlp-metrics
7155
directory: exporter/otlp-metrics
72-
version_constant: [OpenTelemetry, Exporter, OTLP, Metrics, VERSION]
7356

7457
- name: opentelemetry-exporter-zipkin
7558
directory: exporter/zipkin
76-
version_constant: [OpenTelemetry, Exporter, Zipkin, VERSION]
7759

7860
- name: opentelemetry-propagator-b3
7961
directory: propagator/b3
80-
version_constant: [OpenTelemetry, Propagator, B3, VERSION]
8162

8263
- name: opentelemetry-propagator-jaeger
8364
directory: propagator/jaeger
84-
version_constant: [OpenTelemetry, Propagator, Jaeger, VERSION]
8565

8666
- name: opentelemetry-semantic_conventions
8767
directory: semantic_conventions
88-
version_rb_path: lib/opentelemetry/semantic_conventions/version.rb
89-
version_constant: [OpenTelemetry, SemanticConventions, VERSION]
9068

9169
- name: opentelemetry-test-helpers
9270
directory: test_helpers
9371
version_rb_path: lib/opentelemetry/test_helpers/version.rb
94-
version_constant: [OpenTelemetry, TestHelpers, VERSION]
9572

9673
- name: opentelemetry-metrics-api
9774
directory: metrics_api
9875
version_rb_path: lib/opentelemetry/metrics/version.rb
99-
version_constant: [OpenTelemetry, Metrics, VERSION]
10076

10177
- name: opentelemetry-metrics-sdk
10278
directory: metrics_sdk
10379
version_rb_path: lib/opentelemetry/sdk/metrics/version.rb
104-
version_constant: [OpenTelemetry, SDK, Metrics, VERSION]
10580

10681
- name: opentelemetry-logs-api
10782
directory: logs_api
10883
version_rb_path: lib/opentelemetry/logs/version.rb
109-
version_constant: [OpenTelemetry, Logs, VERSION]
11084

11185
- name: opentelemetry-logs-sdk
11286
directory: logs_sdk
11387
version_rb_path: lib/opentelemetry/sdk/logs/version.rb
114-
version_constant: [OpenTelemetry, SDK, Logs, VERSION]

.toys/.toys.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
toys_version! ">= 0.15.5"
1+
# frozen_string_literal: true
22

3-
load_git remote: "https://github.com/dazuma/toys.git",
4-
path: ".toys/release",
5-
as: "release",
6-
commit: "common-tools/v0.15.5.1",
7-
update: 3600
3+
toys_version! ">= 0.19"

.toys/release/.toys.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# frozen_string_literal: true
2+
3+
load_gem 'toys-release'

.toys/release/Gemfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# frozen_string_literal: true
2+
3+
# Copyright The OpenTelemetry Authors
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
7+
source 'https://rubygems.org'
8+
9+
gem 'toys', '= 0.19.1'
10+
gem 'toys-release', '= 0.6.0'

0 commit comments

Comments
 (0)