Skip to content

Commit bd8aca8

Browse files
committed
Wire up the new release automation stuff
1 parent 5997f6c commit bd8aca8

File tree

5 files changed

+70
-50
lines changed

5 files changed

+70
-50
lines changed

.github/workflows/release.yml

Lines changed: 48 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,66 +2,75 @@ name: "Mongoid Release"
22
run-name: "Mongoid Release for ${{ github.ref }}"
33

44
on:
5-
workflow_dispatch:
6-
inputs:
7-
dry_run:
8-
description: Whether this is a dry run or not
9-
required: true
10-
default: true
11-
type: boolean
5+
# for auto-deploy when merging a release-candidate PR
6+
pull_request:
7+
types: [ closed ]
128

139
env:
1410
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.
1711

18-
**Release Highlights**
12+
permissions:
13+
# required for all workflows
14+
security-events: write
1915

20-
TODO: one or more paragraphs describing important changes in this release
16+
# required to fetch internal or private CodeQL packs
17+
packages: read
2118

22-
**Documentation**
19+
# only required for workflows in private repositories
20+
actions: read
21+
pull-requests: read
22+
contents: write
2323

24-
Documentation is available at [MongoDB.com](https://www.mongodb.com/docs/mongoid/current/).
24+
# required by the mongodb-labs/drivers-github-tools/setup@v2 step
25+
# also required by `rubygems/release-gem`
26+
id-token: write
2527

26-
**Installation**
27-
28-
You may install this version via RubyGems, with:
28+
jobs:
29+
check:
30+
name: "Check Release"
31+
runs-on: ubuntu-latest
32+
outputs:
33+
message: ${{ steps.check.outputs.message }}
34+
ref: ${{ steps.check.outputs.ref }}
35+
steps:
36+
- name: "Run the check action"
37+
id: check
38+
uses: jamis/drivers-github-tools/ruby/pr-check@ruby-3643-update-release-process
2939

30-
gem install --version {0} mongoid
40+
build:
41+
name: "Build Gems"
42+
needs: check
43+
environment: release
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: "Run the build action"
47+
uses: jamis/drivers-github-tools/ruby/build@ruby-3643-update-release-process
48+
with:
49+
app_id: ${{ vars.APP_ID }}
50+
app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
51+
artifact: mongoid
52+
gem_name: mongoid
53+
ruby_version: 'ruby-3.2'
54+
ref: ${{ needs.check.outputs.ref }}
3155

32-
jobs:
33-
release:
34-
name: "Mongoid Release"
56+
publish:
57+
name: "Publish Gems"
58+
needs: [ check, build ]
3559
environment: release
3660
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-
5361
steps:
5462
- name: "Run the publish action"
55-
uses: mongodb-labs/drivers-github-tools/ruby/publish@v2
63+
uses: jamis/drivers-github-tools/ruby/publish@ruby-3643-update-release-process
5664
with:
5765
app_id: ${{ vars.APP_ID }}
5866
app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
5967
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
6068
aws_region_name: ${{ vars.AWS_REGION_NAME }}
6169
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}
62-
dry_run: ${{ inputs.dry_run }}
70+
dry_run: false
6371
gem_name: mongoid
6472
product_name: Mongoid
6573
product_id: mongoid
66-
release_message_template: ${{ env.RELEASE_MESSAGE_TEMPLATE }}
74+
release_message: ${{ needs.check.outputs.message }}
6775
silk_asset_group: ${{ env.SILK_ASSET_GROUP }}
76+
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: 4 additions & 1 deletion
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
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.
58
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)