Skip to content

Commit 9b0cffd

Browse files
authored
Release process updates (#6017)
1 parent e65ae33 commit 9b0cffd

File tree

5 files changed

+85
-53
lines changed

5 files changed

+85
-53
lines changed

.github/workflows/release.yml

Lines changed: 62 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,88 @@
1-
name: "Mongoid Release"
2-
run-name: "Mongoid Release for ${{ github.ref }}"
1+
name: "Gem Release"
2+
run-name: "Gem Release for ${{ github.ref }}"
33

44
on:
5+
# for auto-deploy when merging a release-candidate PR
6+
push:
7+
branches:
8+
- 'master'
9+
- '*-stable'
10+
11+
# for manual release
512
workflow_dispatch:
613
inputs:
7-
dry_run:
8-
description: Whether this is a dry run or not
14+
pr:
15+
description: "The number of the merged release candidate PR"
916
required: true
10-
default: true
11-
type: boolean
1217

1318
env:
1419
SILK_ASSET_GROUP: mongoid
15-
RELEASE_MESSAGE_TEMPLATE: |
16-
Version {0} of the [Mongoid ODM for MongoDB](https://rubygems.org/gems/mongoid) is now available.
17-
18-
**Release Highlights**
20+
GEM_NAME: mongoid
21+
PRODUCT_NAME: Mongoid
22+
PRODUCT_ID: mongoid
1923

20-
TODO: one or more paragraphs describing important changes in this release
24+
permissions:
25+
# required for all workflows
26+
security-events: write
2127

22-
**Documentation**
28+
# required to fetch internal or private CodeQL packs
29+
packages: read
2330

24-
Documentation is available at [MongoDB.com](https://www.mongodb.com/docs/mongoid/current/).
31+
# only required for workflows in private repositories
32+
actions: read
33+
pull-requests: read
34+
contents: write
2535

26-
**Installation**
36+
# required by the mongodb-labs/drivers-github-tools/setup@v2 step
37+
# also required by `rubygems/release-gem`
38+
id-token: write
2739

28-
You may install this version via RubyGems, with:
40+
jobs:
41+
check:
42+
name: "Check Release"
43+
runs-on: ubuntu-latest
44+
outputs:
45+
message: ${{ steps.check.outputs.message }}
46+
ref: ${{ steps.check.outputs.ref }}
47+
steps:
48+
- name: "Run the check action"
49+
id: check
50+
uses: jamis/drivers-github-tools/ruby/pr-check@ruby-3643-update-release-process
2951

30-
gem install --version {0} mongoid
52+
build:
53+
name: "Build Gems"
54+
needs: check
55+
environment: release
56+
runs-on: ubuntu-latest
57+
steps:
58+
- name: "Run the build action"
59+
uses: jamis/drivers-github-tools/ruby/build@ruby-3643-update-release-process
60+
with:
61+
app_id: ${{ vars.APP_ID }}
62+
app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
63+
artifact: 'ruby-3.2'
64+
gem_name: ${{ env.GEM_NAME }}
65+
ruby_version: 'ruby-3.2'
66+
ref: ${{ needs.check.outputs.ref }}
3167

32-
jobs:
33-
release:
34-
name: "Mongoid Release"
68+
publish:
69+
name: "Publish Gems"
70+
needs: [ check, build ]
3571
environment: release
3672
runs-on: 'ubuntu-latest'
37-
38-
permissions:
39-
# required for all workflows
40-
security-events: write
41-
42-
# required to fetch internal or private CodeQL packs
43-
packages: read
44-
45-
# only required for workflows in private repositories
46-
actions: read
47-
contents: write
48-
49-
# required by the mongodb-labs/drivers-github-tools/setup@v2 step
50-
# also required by `rubygems/release-gem`
51-
id-token: write
52-
5373
steps:
5474
- name: "Run the publish action"
55-
uses: mongodb-labs/drivers-github-tools/ruby/publish@v2
75+
uses: jamis/drivers-github-tools/ruby/publish@ruby-3643-update-release-process
5676
with:
5777
app_id: ${{ vars.APP_ID }}
5878
app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
5979
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
6080
aws_region_name: ${{ vars.AWS_REGION_NAME }}
6181
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}
62-
bundler_cache_version: 1
63-
dry_run: ${{ inputs.dry_run }}
64-
gem_name: mongoid
65-
product_name: Mongoid
66-
product_id: mongoid
67-
release_message_template: ${{ env.RELEASE_MESSAGE_TEMPLATE }}
82+
dry_run: false
83+
gem_name: ${{ env.GEM_NAME }}
84+
product_name: ${{ env.PRODUCT_NAME }}
85+
product_id: ${{ env.PRODUCT_ID }}
86+
release_message: ${{ needs.check.outputs.message }}
6887
silk_asset_group: ${{ env.SILK_ASSET_GROUP }}
88+
ref: ${{ needs.check.outputs.ref }}

Rakefile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ $: << File.join(ROOT, 'spec/shared/lib')
1010
require "rake"
1111
require "rspec/core/rake_task"
1212

13-
# stands in for the Bundler-provided `build` task, which builds the
14-
# gem for this project. Our release process builds the gems in a
15-
# particular way, in a GitHub action. This task is just to help remind
16-
# developers of that fact.
13+
if File.exist?('./spec/shared/lib/tasks/candidate.rake')
14+
load 'spec/shared/lib/tasks/candidate.rake'
15+
end
16+
17+
desc 'Build the gem'
1718
task :build do
18-
abort <<~WARNING
19-
`rake build` does nothing in this project. The gem must be built via
20-
the `Mongoid Release` action on GitHub, which is triggered manually when
21-
a new release is ready.
22-
WARNING
19+
command = %w[ gem build ]
20+
command << "--output=#{ENV['GEM_FILE_NAME']}" if ENV['GEM_FILE_NAME']
21+
command << (ENV['GEMSPEC'] || 'mongoid.gemspec')
22+
system(*command)
2323
end
2424

2525
# `rake version` is used by the deployment system so get the release version

lib/mongoid/version.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# frozen_string_literal: true
22

33
module Mongoid
4-
VERSION = "8.1.10"
4+
# The current version of Mongoid
5+
#
6+
# Note that this file is automatically updated via `rake candidate:create`.
7+
# Manual changes to this file will be overwritten by that rake task.
8+
VERSION = '8.1.10'
59
end

product.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
name: Mongoid
3+
description: a Ruby ODM for MongoDB
4+
package: mongoid
5+
jira: https://jira.mongodb.org/projects/MONGOID
6+
version:
7+
number: 8.1.10
8+
file: lib/mongoid/version.rb

0 commit comments

Comments
 (0)