From 262000e9fce78b12fef2217a9d085bf6ebd6691f Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Tue, 3 Jun 2025 14:28:06 -0600 Subject: [PATCH 1/8] use new candidate tasks for release management --- Rakefile | 2 ++ lib/mongo/version.rb | 17 +++-------------- spec/shared | 2 +- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/Rakefile b/Rakefile index 5b4bcc744f..8c160e19ac 100644 --- a/Rakefile +++ b/Rakefile @@ -4,6 +4,8 @@ require 'bundler' require 'rspec/core/rake_task' +load 'spec/shared/lib/tasks/candidate.rake' + ROOT = File.expand_path(File.join(File.dirname(__FILE__))) $: << File.join(ROOT, 'spec/shared/lib') diff --git a/lib/mongo/version.rb b/lib/mongo/version.rb index f0a43b1583..33d0a5f7ae 100644 --- a/lib/mongo/version.rb +++ b/lib/mongo/version.rb @@ -1,20 +1,9 @@ # frozen_string_literal: true -# Copyright (C) 2014-2020 MongoDB Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - module Mongo # The current version of the driver. + # + # Note that this file is automatically updated via `rake candidate:create`. + # Manual changes to this file will be overwritten by that rake task. VERSION = '2.21.1' end diff --git a/spec/shared b/spec/shared index 5f716f6c2d..a59235a9fd 160000 --- a/spec/shared +++ b/spec/shared @@ -1 +1 @@ -Subproject commit 5f716f6c2d96737dfbf3c1215882517e13e1fee4 +Subproject commit a59235a9fd96c545105f8f1f9dec49738e1c0a3c From 313a4271763c04ae7d7d800e9e12be1f16e49702 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Mon, 16 Jun 2025 16:12:54 -0600 Subject: [PATCH 2/8] update the release workflow --- .github/workflows/release.yml | 95 +++++++++++++++++++++-------------- 1 file changed, 56 insertions(+), 39 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1232eb9e5e..4ee6a991e0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,66 +2,83 @@ name: "Driver Release" run-name: "Driver Release for ${{ github.ref }}" on: - workflow_dispatch: - inputs: - dry_run: - description: Whether this is a dry run or not - required: true - default: true - type: boolean + # for auto-deploy when merging a release-candidate PR + pull_request: + types: [ closed ] + + # for manual release trigger: "/release" in a comment on a merged + # release-candidate PR (useful if the auto-deploy fails) + # + # Note: this is commented out because it may be more effective to + # just retry the failed job in the Actions UI. + # issue_comment: + # types: [ created ] env: SILK_ASSET_GROUP: mongodb-ruby-driver - RELEASE_MESSAGE_TEMPLATE: | - Version {0} of the [MongoDB Ruby Driver](https://rubygems.org/gems/mongo) is now available. - - **Release Highlights** - TODO: one or more paragraphs describing important changes in this release +permissions: + # required for all workflows + security-events: write - **Documentation** + # required to fetch internal or private CodeQL packs + packages: read - Documentation is available at [MongoDB.com](https://www.mongodb.com/docs/ruby-driver/current/). + # only required for workflows in private repositories + actions: read + pull-requests: read + contents: write - **Installation** + # required by the mongodb-labs/drivers-github-tools/setup@v2 step + # also required by `rubygems/release-gem` + id-token: write - You may install this version via RubyGems, with: +jobs: + check: + name: "Check Release" + runs-on: ubuntu-latest + outputs: + message: ${{ steps.check.outputs.message }} + ref: ${{ steps.check.outputs.ref }} + steps: + - name: "Run the check action" + id: check + uses: jamis/drivers-github-tools/ruby/pr-check@ruby-3643-update-release-process - gem install --version {0} mongo + build: + name: "Build Gems" + needs: check + environment: release + runs-on: ubuntu-latest + steps: + - name: "Run the build action" + uses: jamis/drivers-github-tools/ruby/build@ruby-3643-update-release-process + with: + app_id: ${{ vars.APP_ID }} + app_private_key: ${{ secrets.APP_PRIVATE_KEY }} + artifact: mongo-ruby-driver + gem_name: mongo + ruby_version: 'ruby-3.2' + ref: ${{ needs.check.outputs.ref }} -jobs: - release: - name: "Driver Release" + publish: + name: "Publish Gems" + needs: [ check, build ] environment: release runs-on: 'ubuntu-latest' - - permissions: - # required for all workflows - security-events: write - - # required to fetch internal or private CodeQL packs - packages: read - - # only required for workflows in private repositories - actions: read - contents: write - - # required by the mongodb-labs/drivers-github-tools/setup@v2 step - # also required by `rubygems/release-gem` - id-token: write - steps: - name: "Run the publish action" - uses: mongodb-labs/drivers-github-tools/ruby/publish@v2 + uses: jamis/drivers-github-tools/ruby/publish@ruby-3643-update-release-process with: app_id: ${{ vars.APP_ID }} app_private_key: ${{ secrets.APP_PRIVATE_KEY }} aws_role_arn: ${{ secrets.AWS_ROLE_ARN }} aws_region_name: ${{ vars.AWS_REGION_NAME }} aws_secret_id: ${{ secrets.AWS_SECRET_ID }} - dry_run: ${{ inputs.dry_run }} + dry_run: false gem_name: mongo product_name: Ruby Driver product_id: mongodb-ruby-driver - release_message_template: ${{ env.RELEASE_MESSAGE_TEMPLATE }} + release_message: ${{ needs.check.outputs.message }} silk_asset_group: ${{ env.SILK_ASSET_GROUP }} + ref: ${{ needs.check.outputs.ref }} From 26d14fb7d861e54db047310993d1f46d24108be8 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Mon, 16 Jun 2025 16:19:24 -0600 Subject: [PATCH 3/8] don't load candidate rake tasks if the file isn't there this prevents us from having to load submodules during the release process, just to pick up tasks that aren't needed. --- Rakefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 8c160e19ac..0918b05227 100644 --- a/Rakefile +++ b/Rakefile @@ -4,7 +4,9 @@ require 'bundler' require 'rspec/core/rake_task' -load 'spec/shared/lib/tasks/candidate.rake' +if File.exist?('./spec/shared/lib/tasks/candidate.rake') + load 'spec/shared/lib/tasks/candidate.rake' +end ROOT = File.expand_path(File.join(File.dirname(__FILE__))) From 94bac77aca077f350138123de1d8b0eb57ff74cf Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Tue, 17 Jun 2025 13:38:14 -0600 Subject: [PATCH 4/8] Let the build task create the gem --- Rakefile | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Rakefile b/Rakefile index 0918b05227..845086859e 100644 --- a/Rakefile +++ b/Rakefile @@ -38,16 +38,12 @@ end task :default => ['spec:prepare', :spec] -# stands in for the Bundler-provided `build` task, which builds the -# gem for this project. Our release process builds the gems in a -# particular way, in a GitHub action. This task is just to help remind -# developers of that fact. +desc 'Build the gem' task :build do - abort <<~WARNING - `rake build` does nothing in this project. The gem must be built via - the `Driver Release` action on GitHub, which is triggered manually when - a new release is ready. - WARNING + command = %w[ gem build ] + command << "--output=#{ENV['GEM_FILE_NAME']}" if ENV['GEM_FILE_NAME'] + command << (ENV['GEMSPEC'] || 'mongo.gemspec') + system(*command) end # `rake version` is used by the deployment system so get the release version From cc2bff28e5c8a54751ed4dad8c2300a50db14d0d Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Tue, 17 Jun 2025 16:01:13 -0600 Subject: [PATCH 5/8] bump spec/shared for candidate code update --- spec/shared | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/shared b/spec/shared index a59235a9fd..6b1158f69f 160000 --- a/spec/shared +++ b/spec/shared @@ -1 +1 @@ -Subproject commit a59235a9fd96c545105f8f1f9dec49738e1c0a3c +Subproject commit 6b1158f69f7a23345259223bc305393b86e9ab3e From 3e607bfaf5140092e7fa1099cc31140ec0a1222d Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Thu, 19 Jun 2025 10:41:54 -0600 Subject: [PATCH 6/8] use the push & workflow_dispatch triggers --- .github/workflows/release.yml | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4ee6a991e0..77f3289e6c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,21 +1,24 @@ -name: "Driver Release" -run-name: "Driver Release for ${{ github.ref }}" +name: "Gem Release" +run-name: "Gem Release for ${{ github.ref }}" on: # for auto-deploy when merging a release-candidate PR - pull_request: - types: [ closed ] + push: + - 'master' + - '*-stable' - # for manual release trigger: "/release" in a comment on a merged - # release-candidate PR (useful if the auto-deploy fails) - # - # Note: this is commented out because it may be more effective to - # just retry the failed job in the Actions UI. - # issue_comment: - # types: [ created ] + # for manual release + workflow_dispatch: + inputs: + pr: + description: "The number of the merged release candidate PR" + required: true env: SILK_ASSET_GROUP: mongodb-ruby-driver + GEM_NAME: mongo + PRODUCT_NAME: Ruby Driver + PRODUCT_ID: mongodb-ruby-driver permissions: # required for all workflows @@ -56,8 +59,8 @@ jobs: with: app_id: ${{ vars.APP_ID }} app_private_key: ${{ secrets.APP_PRIVATE_KEY }} - artifact: mongo-ruby-driver - gem_name: mongo + artifact: 'ruby-3.2' + gem_name: ${{ env.GEM_NAME }} ruby_version: 'ruby-3.2' ref: ${{ needs.check.outputs.ref }} @@ -76,9 +79,9 @@ jobs: aws_region_name: ${{ vars.AWS_REGION_NAME }} aws_secret_id: ${{ secrets.AWS_SECRET_ID }} dry_run: false - gem_name: mongo - product_name: Ruby Driver - product_id: mongodb-ruby-driver + gem_name: ${{ env.GEM_NAME }} + product_name: ${{ env.PRODUCT_NAME }} + product_id: ${{ env.PRODUCT_ID }} release_message: ${{ needs.check.outputs.message }} silk_asset_group: ${{ env.SILK_ASSET_GROUP }} ref: ${{ needs.check.outputs.ref }} From cee0bcee7e9a18ba1dbaa7ea76490e8d1cf6f014 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Mon, 23 Jun 2025 07:51:33 -0600 Subject: [PATCH 7/8] add the product.yml file --- product.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 product.yml diff --git a/product.yml b/product.yml new file mode 100644 index 0000000000..d5c5f3c76b --- /dev/null +++ b/product.yml @@ -0,0 +1,8 @@ +--- +name: MongoDB Ruby Driver +description: a pure-Ruby driver for connecting to, querying, and manipulating MongoDB databases +package: mongo +jira: https://jira.mongodb.org/projects/RUBY +version: + number: 2.21.1 + file: lib/mongo/version.rb From ccde48db18f4be1b6b9bea22304107343b908c99 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Tue, 24 Jun 2025 10:36:28 -0600 Subject: [PATCH 8/8] fix typo in release.yml --- .github/workflows/release.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 77f3289e6c..fbaf66a533 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,8 +4,9 @@ run-name: "Gem Release for ${{ github.ref }}" on: # for auto-deploy when merging a release-candidate PR push: - - 'master' - - '*-stable' + branches: + - 'master' + - '*-stable' # for manual release workflow_dispatch: