Skip to content

RUBY-3643 New release process (backport to 9.0) #6002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: 9.0-stable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 62 additions & 41 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,67 +1,88 @@
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:
branches:
- '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 }}
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 }}
18 changes: 9 additions & 9 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,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
Expand Down
7 changes: 5 additions & 2 deletions lib/mongoid/version.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# frozen_string_literal: true
# rubocop:todo all

module Mongoid
VERSION = "9.0.6"
# 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 = '9.0.6'
end
7 changes: 0 additions & 7 deletions mongoid.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ Gem::Specification.new do |s|
'source_code_uri' => 'https://github.com/mongodb/mongoid',
}

if File.exist?('gem-private_key.pem')
s.signing_key = 'gem-private_key.pem'
s.cert_chain = ['gem-public_cert.pem']
else
warn "[#{s.name}] Warning: No private key present, creating unsigned gem."
end

s.required_ruby_version = ">= 2.7"
s.required_rubygems_version = ">= 1.3.6"

Expand Down
8 changes: 8 additions & 0 deletions product.yml
Original file line number Diff line number Diff line change
@@ -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.6
file: lib/mongoid/version.rb
2 changes: 1 addition & 1 deletion spec/shared
Loading