Skip to content

Commit c802b46

Browse files
authored
RUBY-3410 Updated release automation (#5994)
* Wire up the new release automation stuff * update the release triggers * single quote the version string
1 parent 8eb4727 commit c802b46

File tree

5 files changed

+84
-53
lines changed

5 files changed

+84
-53
lines changed

.github/workflows/release.yml

Lines changed: 61 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,87 @@
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+
- 'master'
8+
- '*-stable'
9+
10+
# for manual release
511
workflow_dispatch:
612
inputs:
7-
dry_run:
8-
description: Whether this is a dry run or not
13+
pr:
14+
description: "The number of the merged release candidate PR"
915
required: true
10-
default: true
11-
type: boolean
1216

1317
env:
1418
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**
19+
GEM_NAME: mongoid
20+
PRODUCT_NAME: Mongoid
21+
PRODUCT_ID: mongoid
1922

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

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

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

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

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

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

32-
jobs:
33-
release:
34-
name: "Mongoid Release"
67+
publish:
68+
name: "Publish Gems"
69+
needs: [ check, build ]
3570
environment: release
3671
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-
5372
steps:
5473
- name: "Run the publish action"
55-
uses: mongodb-labs/drivers-github-tools/ruby/publish@v2
74+
uses: jamis/drivers-github-tools/ruby/publish@ruby-3643-update-release-process
5675
with:
5776
app_id: ${{ vars.APP_ID }}
5877
app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
5978
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
6079
aws_region_name: ${{ vars.AWS_REGION_NAME }}
6180
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}
62-
dry_run: ${{ inputs.dry_run }}
63-
gem_name: mongoid
64-
product_name: Mongoid
65-
product_id: mongoid
66-
release_message_template: ${{ env.RELEASE_MESSAGE_TEMPLATE }}
81+
dry_run: false
82+
gem_name: ${{ env.GEM_NAME }}
83+
product_name: ${{ env.PRODUCT_NAME }}
84+
product_id: ${{ env.PRODUCT_ID }}
85+
release_message: ${{ needs.check.outputs.message }}
6786
silk_asset_group: ${{ env.SILK_ASSET_GROUP }}
87+
ref: ${{ needs.check.outputs.ref }}

Rakefile

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

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

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

lib/mongoid/version.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# frozen_string_literal: true
2-
# rubocop:todo all
32

43
module Mongoid
5-
VERSION = "9.0.2"
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 = '9.0.2'
69
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: an Ruby ODM for MongoDB
4+
package: mongoid
5+
jira: https://jira.mongodb.org/projects/MONGOID
6+
version:
7+
number: 9.0.2
8+
file: lib/mongoid/version.rb

0 commit comments

Comments
 (0)