From 2bae12b2cff84f35103bd4b39ca292d613c4c818 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Tue, 24 Jun 2025 10:18:01 -0600 Subject: [PATCH 1/3] RUBY-3410 Updated release automation (#5994) * Wire up the new release automation stuff * update the release triggers * single quote the version string --- .github/workflows/release.yml | 103 ++++++++++++++++++++-------------- Rakefile | 18 +++--- lib/mongoid/version.rb | 6 +- product.yml | 8 +++ spec/shared | 2 +- 5 files changed, 84 insertions(+), 53 deletions(-) create mode 100644 product.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0f72db7dc8..31d1d5fcbf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,68 +1,87 @@ -name: "Mongoid Release" -run-name: "Mongoid Release for ${{ github.ref }}" +name: "Gem Release" +run-name: "Gem Release for ${{ github.ref }}" on: + # for auto-deploy when merging a release-candidate PR + push: + - 'master' + - '*-stable' + + # for manual release workflow_dispatch: inputs: - dry_run: - description: Whether this is a dry run or not + pr: + description: "The number of the merged release candidate PR" required: true - default: true - type: boolean env: SILK_ASSET_GROUP: mongoid - RELEASE_MESSAGE_TEMPLATE: | - Version {0} of the [Mongoid ODM for MongoDB](https://rubygems.org/gems/mongoid) is now available. - - **Release Highlights** + GEM_NAME: mongoid + PRODUCT_NAME: Mongoid + PRODUCT_ID: mongoid - 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/mongoid/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} mongoid + 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: 'ruby-3.2' + gem_name: ${{ env.GEM_NAME }} + ruby_version: 'ruby-3.2' + ref: ${{ needs.check.outputs.ref }} -jobs: - release: - name: "Mongoid 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 }} - bundler_cache_version: 1 - dry_run: ${{ inputs.dry_run }} - gem_name: mongoid - product_name: Mongoid - product_id: mongoid - release_message_template: ${{ env.RELEASE_MESSAGE_TEMPLATE }} + dry_run: false + 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 }} diff --git a/Rakefile b/Rakefile index 616120f4d0..4892dc2667 100644 --- a/Rakefile +++ b/Rakefile @@ -10,16 +10,16 @@ $: << File.join(ROOT, 'spec/shared/lib') require "rake" require "rspec/core/rake_task" -# 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. +if File.exist?('./spec/shared/lib/tasks/candidate.rake') + load 'spec/shared/lib/tasks/candidate.rake' +end + +desc 'Build the gem' task :build do - abort <<~WARNING - `rake build` does nothing in this project. The gem must be built via - the `Mongoid 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'] || 'mongoid.gemspec') + system(*command) end # `rake version` is used by the deployment system so get the release version diff --git a/lib/mongoid/version.rb b/lib/mongoid/version.rb index 1653aa3896..393fc5644e 100644 --- a/lib/mongoid/version.rb +++ b/lib/mongoid/version.rb @@ -1,5 +1,9 @@ # frozen_string_literal: true module Mongoid - VERSION = "8.1.10" + # The current version of Mongoid + # + # Note that this file is automatically updated via `rake candidate:create`. + # Manual changes to this file will be overwritten by that rake task. + VERSION = '8.1.10' end diff --git a/product.yml b/product.yml new file mode 100644 index 0000000000..7955a4bcac --- /dev/null +++ b/product.yml @@ -0,0 +1,8 @@ +--- +name: Mongoid +description: an Ruby ODM for MongoDB +package: mongoid +jira: https://jira.mongodb.org/projects/MONGOID +version: + number: 9.0.2 + file: lib/mongoid/version.rb 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 2bf6d403b09dc3c28e83d88171d9a57f7956e189 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Tue, 24 Jun 2025 14:21:08 -0600 Subject: [PATCH 2/3] fix error in release.yml (#6000) --- .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 31d1d5fcbf..ed77f56a5d 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: From c81794cff718adaecf42bf1f789cc00ed45acc07 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Thu, 26 Jun 2025 11:04:55 -0600 Subject: [PATCH 3/3] update product.yml --- product.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product.yml b/product.yml index 7955a4bcac..57da0b0192 100644 --- a/product.yml +++ b/product.yml @@ -4,5 +4,5 @@ description: an Ruby ODM for MongoDB package: mongoid jira: https://jira.mongodb.org/projects/MONGOID version: - number: 9.0.2 + number: 8.1.10 file: lib/mongoid/version.rb