Skip to content

Commit e1af343

Browse files
authored
chore: update release automation scripts 5.x (#3823)
1 parent c0d3927 commit e1af343

File tree

9 files changed

+63
-14
lines changed

9 files changed

+63
-14
lines changed

.github/scripts/highlights.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ async function pullRequestHighlights(prs) {
7070
if (!highlights.length) return '';
7171

7272
highlights.unshift('## Release Notes\n\n');
73-
return highlights.join('\n\n');
73+
74+
const highlight = highlights.join('\n\n');
75+
console.log(`Total highlight is ${highlight.length} characters long`);
76+
return highlight;
7477
}
7578

7679
console.log('List of PRs to collect highlights from:', prs);

.github/scripts/pr_list.mjs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@ const historyFilePath = path.join(__dirname, '..', '..', 'HISTORY.md');
1313
*/
1414
function parsePRList(history) {
1515
const prRegexp = /node-mongodb-native\/issues\/(?<prNum>\d+)\)/iu;
16-
return history
17-
.split('\n')
18-
.map(line => prRegexp.exec(line)?.groups?.prNum ?? '')
19-
.filter(prNum => prNum !== '');
16+
return Array.from(
17+
new Set(
18+
history
19+
.split('\n')
20+
.map(line => prRegexp.exec(line)?.groups?.prNum ?? '')
21+
.filter(prNum => prNum !== '')
22+
)
23+
);
2024
}
2125

2226
const historyContents = await fs.readFile(historyFilePath, { encoding: 'utf8' });

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
permissions:
77
contents: write
88
pull-requests: write
9+
id-token: write
910

1011
name: release-4x
1112

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
on:
2+
push:
3+
branches: [5.x]
4+
workflow_dispatch: {}
5+
6+
permissions:
7+
contents: write
8+
pull-requests: write
9+
id-token: write
10+
11+
name: release-5x
12+
13+
jobs:
14+
release-please:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- 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: 5.x
28+
29+
# If release-please created a release, publish to npm
30+
- if: ${{ steps.release.outputs.release_created }}
31+
uses: actions/checkout@v3
32+
- if: ${{ steps.release.outputs.release_created }}
33+
name: actions/setup
34+
uses: ./.github/actions/setup
35+
- if: ${{ steps.release.outputs.release_created }}
36+
run: npm publish --provenance --tag=5x
37+
env:
38+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/release-alpha.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ on:
88
required: true
99
type: string
1010

11+
permissions:
12+
id-token: write
13+
1114
name: release-alpha
1215

1316
jobs:
1417
release-alpha:
1518
runs-on: ubuntu-latest
16-
permissions:
17-
id-token: write
1819
steps:
1920
- shell: bash
2021
run: |

.github/workflows/release-nightly.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ on:
1111
# As long as the commit hash has changed on main a release will be published
1212
workflow_dispatch: {}
1313

14+
permissions:
15+
id-token: write
16+
1417
name: release-nightly
1518

1619
jobs:
1720
release-nightly:
1821
runs-on: ubuntu-latest
19-
permissions:
20-
id-token: write
2122
steps:
2223
- uses: actions/checkout@v3
2324
- name: actions/setup

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
permissions:
77
contents: write
88
pull-requests: write
9+
id-token: write
910

1011
name: release
1112

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"@microsoft/api-extractor": "^7.35.1",
6363
"@microsoft/tsdoc-config": "^0.16.2",
6464
"@mongodb-js/zstd": "^1.1.0",
65-
"@octokit/core": "^4.2.1",
65+
"@octokit/core": "^4.2.4",
6666
"@types/chai": "^4.3.5",
6767
"@types/chai-subset": "^1.3.3",
6868
"@types/express": "^4.17.17",

0 commit comments

Comments
 (0)