Skip to content

Commit f8e87c9

Browse files
authored
RUBY-3643 Update for new release process (#356)
* prep for new release * update the release process to use new actions * codeql task needs submodules
1 parent ddbfce8 commit f8e87c9

File tree

6 files changed

+56
-143
lines changed

6 files changed

+56
-143
lines changed

.github/workflows/codeql.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ jobs:
3636
steps:
3737
- name: Checkout repository
3838
uses: actions/checkout@v4
39+
with:
40+
submodules: true
3941

4042
- name: Setup Ruby
4143
if: matrix.build-mode == 'manual'

.github/workflows/release.yml

Lines changed: 40 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,17 @@ name: "BSON Release"
22
run-name: "BSON 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 ]
8+
9+
# for manual release trigger: "/release" in a comment on a merged
10+
# release-candidate PR (useful if the auto-deploy fails)
11+
issue_comment:
12+
types: [ created ]
1213

1314
env:
1415
SILK_ASSET_GROUP: bson-ruby
15-
RELEASE_MESSAGE_TEMPLATE: |
16-
Version {0} of [BSON for Ruby](https://rubygems.org/gems/bson) is now available.
17-
18-
**Release Highlights**
19-
20-
TODO: one or more paragraphs describing important changes in this release
21-
22-
**Documentation**
23-
24-
Documentation is available at [MongoDB.com](https://www.mongodb.com/docs/ruby-driver/current/tutorials/bson/).
25-
26-
**Installation**
27-
28-
You may install this version via RubyGems, with:
29-
30-
gem install --version {0} bson
3116

3217
permissions:
3318
# required for all workflows
@@ -38,133 +23,62 @@ permissions:
3823

3924
# only required for workflows in private repositories
4025
actions: read
26+
pull-request: read
4127
contents: write
4228

4329
# required by the mongodb-labs/drivers-github-tools/setup@v2 step
4430
# also required by `rubygems/release-gem`
4531
id-token: write
4632

4733
jobs:
34+
check:
35+
name: "Check Release"
36+
runs-on: ubuntu-latest
37+
outputs:
38+
message: ${{ steps.check.outputs.message }}
39+
ref: ${{ steps.check.outputs.ref }}
40+
steps:
41+
- name: "Run the check action"
42+
id: check
43+
uses: jamis/drivers-github-tools/ruby/pr-check@ruby-3643-update-release-process
44+
4845
build:
4946
name: "Build Gems"
47+
needs: check
5048
runs-on: ubuntu-latest
5149
strategy:
5250
fail-fast: false
5351
matrix:
54-
ruby: [ '3.2', jruby ]
52+
ruby: [ 'ruby-3.2', 'jruby-9.4' ]
5553
steps:
56-
- name: Check out the repository
57-
uses: actions/checkout@v4
58-
59-
- name: Setup Ruby
60-
uses: ruby/setup-ruby@v1
61-
with:
62-
ruby-version: ${{ matrix.ruby }}
63-
bundler-cache: true
64-
65-
- name: Set output gem file name
66-
shell: bash
67-
run: |
68-
echo "GEM_FILE_NAME=$(bundle exec rake gem_file_name)" >> "$GITHUB_ENV"
69-
70-
- name: Build the gem
71-
shell: bash
72-
run: bundle exec rake build
73-
74-
- name: Save the generated gem file for later
75-
uses: actions/upload-artifact@v4
54+
- name: "Run the build action"
55+
uses: jamis/drivers-github-tools/ruby/build@ruby-3643-update-release-process
7656
with:
77-
name: ${{ env.GEM_FILE_NAME }}
78-
path: ${{ env.GEM_FILE_NAME }}
79-
retention-days: 1
80-
overwrite: true
57+
app_id: ${{ vars.APP_ID }}
58+
app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
59+
artifact: ${{ matrix.ruby }}
60+
gem_name: bson
61+
ruby_version: ${{ matrix.ruby }}
62+
ref: ${{ needs.check.outputs.ref }}
8163

8264
publish:
8365
name: Publish Gems
84-
needs: build
66+
needs: [ check, build ]
8567
environment: release
8668
runs-on: ubuntu-latest
8769
steps:
88-
- name: Check out the repository
89-
uses: mongodb-labs/drivers-github-tools/secure-checkout@v2
70+
- name: "Run the publish action"
71+
uses: jamis/drivers-github-tools/ruby/publish@ruby-3643-update-release-process
9072
with:
9173
app_id: ${{ vars.APP_ID }}
92-
private_key: ${{ secrets.APP_PRIVATE_KEY }}
93-
94-
- name: Setup Ruby
95-
uses: ruby/setup-ruby@v1
96-
with:
97-
ruby-version: '3.2'
98-
bundler-cache: true
99-
100-
- name: Get the release version
101-
shell: bash
102-
run: echo "RELEASE_VERSION=$(bundle exec rake version)" >> "$GITHUB_ENV"
103-
104-
- name: Setup GitHub tooling for DBX Drivers
105-
uses: mongodb-labs/drivers-github-tools/setup@v2
106-
with:
74+
app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
10775
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
10876
aws_region_name: ${{ vars.AWS_REGION_NAME }}
10977
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}
110-
111-
- name: Fetch the gem artifacts
112-
uses: actions/download-artifact@v4
113-
with:
114-
merge-multiple: true
115-
116-
- name: Sign the gems
117-
uses: mongodb-labs/drivers-github-tools/gpg-sign@v2
118-
with:
119-
filenames: '*.gem'
120-
121-
- name: Generate SSDLC Reports
122-
uses: mongodb-labs/drivers-github-tools/full-report@v2
123-
with:
78+
dry_run: false
79+
gem_name: bson
12480
product_name: BSON for Ruby
125-
release_version: ${{ env.RELEASE_VERSION }}
126-
dist_filenames: '*.gem'
127-
silk_asset_group: bson-ruby
128-
129-
- name: Create the tag
130-
uses: mongodb-labs/drivers-github-tools/tag-version@v2
131-
with:
132-
version: ${{ env.RELEASE_VERSION }}
133-
tag_template: "v${VERSION}"
134-
tag_message_template: "Release tag for v${VERSION}"
135-
136-
- name: Create a new release
137-
shell: bash
138-
run: gh release create v${{ env.RELEASE_VERSION }} --title ${{ env.RELEASE_VERSION }} --generate-notes --draft
139-
140-
- name: Capture the changelog
141-
shell: bash
142-
run: gh release view v${{ env.RELEASE_VERSION }} --json body --template '{{ .body }}' >> changelog
143-
144-
- name: Prepare release message
145-
shell: bash
146-
run: |
147-
echo "${{ format(env.RELEASE_MESSAGE_TEMPLATE, env.RELEASE_VERSION) }}" > release-message
148-
cat changelog >> release-message
149-
150-
- name: Update release information
151-
shell: bash
152-
run: |
153-
echo "RELEASE_URL=$(gh release edit v${{ env.RELEASE_VERSION }} --notes-file release-message)" >> "$GITHUB_ENV"
154-
155-
- name: Upload release artifacts
156-
shell: bash
157-
run: gh release upload v${{ env.RELEASE_VERSION }} *.gem ${{ env.RELEASE_ASSETS }}/*.sig
158-
159-
- name: Upload S3 assets
160-
uses: mongodb-labs/drivers-github-tools/upload-s3-assets@v2
161-
with:
162-
version: ${{ env.RELEASE_VERSION }}
163-
product_name: 'bson-ruby'
164-
dry_run: ${{ inputs.dry_run }}
165-
166-
- name: Publish the gems
167-
uses: rubygems/release-gem@v1
168-
if: inputs.dry_run == false
169-
with:
170-
await-release: false
81+
product_id: mongodb-ruby-driver
82+
release_message: ${{ needs.check.outputs.message }}
83+
silk_asset_group: ${{ env.SILK_ASSET_GROUP }}
84+
ref: ${{ needs.check.outputs.ref }}

Rakefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ require "rake/extensiontask"
2525
require "rspec/core/rake_task"
2626
require 'fileutils'
2727

28+
load 'spec/shared/lib/tasks/candidate.rake'
29+
2830
def jruby?
2931
defined?(JRUBY_VERSION)
3032
end

lib/bson/version.rb

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
11
# frozen_string_literal: true
2-
# rubocop:todo all
3-
4-
# Copyright (C) 2009-2020 MongoDB Inc.
5-
#
6-
# Licensed under the Apache License, Version 2.0 (the "License");
7-
# you may not use this file except in compliance with the License.
8-
# You may obtain a copy of the License at
9-
#
10-
# http://www.apache.org/licenses/LICENSE-2.0
11-
#
12-
# Unless required by applicable law or agreed to in writing, software
13-
# distributed under the License is distributed on an "AS IS" BASIS,
14-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
# See the License for the specific language governing permissions and
16-
# limitations under the License.
172

183
module BSON
19-
VERSION = "5.0.2"
4+
# The current version of the library.
5+
#
6+
# NOTE: this file is automatically updated via `rake candidate:create`.
7+
# Manual changes to this file may be overwritten by that rake task.
8+
VERSION = '5.0.2'
209
end

product.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
name: BSON for Ruby
3+
package: bson
4+
version:
5+
number: 5.0.2
6+
file: lib/bson/version.rb

0 commit comments

Comments
 (0)