Skip to content

Commit 8d55f7d

Browse files
authored
chore(NODE-6033): sync release flows and add release-please files (#4106)
1 parent 7ae6eac commit 8d55f7d

11 files changed

+69
-74
lines changed

.github/actions/setup/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: 'Installs node, driver dependencies, and builds source'
44
runs:
55
using: composite
66
steps:
7-
- uses: actions/setup-node@v3
7+
- uses: actions/setup-node@v4
88
with:
99
node-version: 'lts/*'
1010
cache: 'npm'

.github/workflows/build_docs.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ jobs:
1818
runs-on: ubuntu-latest
1919

2020
steps:
21-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
2222
- name: actions/setup
2323
uses: ./.github/actions/setup
2424
- run: sudo apt-get install hugo
2525
- name: Build Docs
2626
run: npm run build:docs -- --yes
2727
- name: Open Pull Request
28-
uses: peter-evans/create-pull-request@v4
28+
uses: peter-evans/create-pull-request@v6
2929
with:
3030
title: 'docs: generate docs from latest main [skip-ci]'
3131
delete-branch: true

.github/workflows/dependencies.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
build:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1717
- name: actions/setup
1818
uses: ./.github/actions/setup
1919
- run: npm run check:dependencies

.github/workflows/release-4.x.yml

-38
This file was deleted.

.github/workflows/release-5.x.yml

+3-10
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,13 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- id: release
18-
uses: google-github-actions/release-please-action@v3
18+
uses: google-github-actions/release-please-action@v4
1919
with:
20-
release-type: node
21-
package-name: mongodb
22-
# Example: chore(main): release 5.7.0 [skip-ci]
23-
# ${scope} - parenthesis included, base branch name
24-
pull-request-title-pattern: 'chore${scope}: release ${version} [skip-ci]'
25-
pull-request-header: 'Please run the release_notes action before releasing to generate release highlights'
26-
changelog-path: HISTORY.md
27-
default-branch: 5.x
20+
target-branch: 5.x
2821

2922
# If release-please created a release, publish to npm
3023
- if: ${{ steps.release.outputs.release_created }}
31-
uses: actions/checkout@v3
24+
uses: actions/checkout@v4
3225
- if: ${{ steps.release.outputs.release_created }}
3326
name: actions/setup
3427
uses: ./.github/actions/setup

.github/workflows/release-alpha.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ jobs:
1919
steps:
2020
- shell: bash
2121
run: |
22-
ALPHA_SEMVER_REGEXP="-alpha(\.(0|[1-9][0-9]+))?$"
22+
ALPHA_SEMVER_REGEXP="-alpha(\.([0-9]|[1-9][0-9]+))?$"
2323
2424
if ! [[ "${{ inputs.alphaVersion }}" =~ $ALPHA_SEMVER_REGEXP ]]; then
2525
echo "Invalid alphaVersion string"
2626
exit 1
2727
fi
28-
- uses: actions/checkout@v3
28+
- uses: actions/checkout@v4
2929
- name: actions/setup
3030
uses: ./.github/actions/setup
3131
- run: npm version "${{ inputs.alphaVersion }}" --git-tag-version=false

.github/workflows/release-nightly.yml

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
on:
2-
# TODO: We can reenable cron when needed
3-
# schedule:
4-
# # Timezone is UTC
5-
# # https://crontab.guru/#0_0_*_*_*
6-
# # At 00:00 every day.
7-
# - cron: '0 0 * * *'
2+
schedule:
3+
# Timezone is UTC
4+
# https://crontab.guru/#0_0_*_*_*
5+
# At 00:00 every day.
6+
- cron: '0 0 * * *'
87

98
# Allows us to manually trigger a nightly
109
# Since npm prevents duplicate releases we can run this at any time
@@ -20,7 +19,7 @@ jobs:
2019
release-nightly:
2120
runs-on: ubuntu-latest
2221
steps:
23-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
2423
- name: actions/setup
2524
uses: ./.github/actions/setup
2625
- id: build_nightly

.github/workflows/release.yml

+2-11
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,11 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- id: release
18-
uses: google-github-actions/release-please-action@v3
19-
with:
20-
release-type: node
21-
package-name: mongodb
22-
# Example: chore(main): release 5.7.0 [skip-ci]
23-
# ${scope} - parenthesis included, base branch name
24-
pull-request-title-pattern: 'chore${scope}: release ${version} [skip-ci]'
25-
pull-request-header: 'Please run the release_notes action before releasing to generate release highlights'
26-
changelog-path: HISTORY.md
27-
default-branch: main
18+
uses: google-github-actions/release-please-action@v4
2819

2920
# If release-please created a release, publish to npm
3021
- if: ${{ steps.release.outputs.release_created }}
31-
uses: actions/checkout@v3
22+
uses: actions/checkout@v4
3223
- if: ${{ steps.release.outputs.release_created }}
3324
name: actions/setup
3425
uses: ./.github/actions/setup

.github/workflows/release_notes.yml

+33-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,44 @@ on:
77
description: 'Enter release PR number'
88
required: true
99
type: number
10+
issue_comment:
11+
types: [created]
12+
13+
permissions:
14+
contents: write
15+
pull-requests: write
1016

1117
jobs:
1218
release_notes:
1319
runs-on: ubuntu-latest
20+
# Run only if dispatched or comment on a pull request
21+
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'issue_comment' && github.event.issue.pull_request && github.event.comment.body == 'run release_notes') }}
1422
steps:
15-
- uses: actions/checkout@v3
23+
# Determine if the triggering_actor is allowed to run this action
24+
# We only permit maintainers
25+
# Not only is 'triggering_actor' common between the trigger events it will also change if someone re-runs an old job
26+
- name: check if triggering_actor is allowed to generate notes
27+
env:
28+
GITHUB_TOKEN: ${{ github.token }}
29+
COMMENTER: ${{ github.triggering_actor && github.triggering_actor || 'empty_triggering_actor' }}
30+
API_ENDPOINT: /repos/${{ github.repository }}/collaborators?permission=maintain
31+
shell: bash
32+
run: |
33+
if [ $COMMENTER = "empty_triggering_actor" ]; then exit 1; fi
34+
set -o pipefail
35+
if gh api "$API_ENDPOINT" --paginate --jq ".[].login" | grep -q "^$COMMENTER\$"; then
36+
echo "$COMMENTER permitted to trigger notes!" && exit 0
37+
else
38+
echo "$COMMENTER not permitted to trigger notes" && exit 1
39+
fi
40+
41+
# checkout the HEAD ref from prNumber
42+
- uses: actions/checkout@v4
43+
with:
44+
ref: refs/pull/${{ github.event_name == 'issue_comment' && github.event.issue.number || inputs.releasePr }}/head
45+
1646

47+
# Setup Node.js and npm install
1748
- name: actions/setup
1849
uses: ./.github/actions/setup
1950

@@ -42,7 +73,7 @@ jobs:
4273
HIGHLIGHTS: ${{ steps.highlights.outputs.highlights }}
4374

4475
# Update the release PR body
45-
- run: gh pr edit ${{ inputs.releasePr }} --body-file ${{ steps.release_notes.outputs.release_notes_path }}
76+
- run: gh pr edit ${{ github.event_name == 'issue_comment' && github.event.issue.number || inputs.releasePr }} --body-file ${{ steps.release_notes.outputs.release_notes_path }}
4677
shell: bash
4778
env:
4879
GITHUB_TOKEN: ${{ github.token }}

.release-please-manifest.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "5.9.2"
3+
}

release-please-config.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"pull-request-title-pattern": "chore${scope}: release ${version} [skip-ci]",
4+
"pull-request-header": "Please run the release_notes action before releasing to generate release highlights",
5+
"packages": {
6+
".": {
7+
"include-component-in-tag": false,
8+
"changelog-path": "HISTORY.md",
9+
"release-type": "node",
10+
"bump-minor-pre-major": false,
11+
"bump-patch-for-minor-pre-major": false,
12+
"draft": false,
13+
"prerelease": false
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)