Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update release automation scripts 5.x #3823

Merged
merged 1 commit into from Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/scripts/highlights.mjs
Expand Up @@ -70,7 +70,10 @@ async function pullRequestHighlights(prs) {
if (!highlights.length) return '';

highlights.unshift('## Release Notes\n\n');
return highlights.join('\n\n');

const highlight = highlights.join('\n\n');
console.log(`Total highlight is ${highlight.length} characters long`);
return highlight;
}

console.log('List of PRs to collect highlights from:', prs);
Expand Down
12 changes: 8 additions & 4 deletions .github/scripts/pr_list.mjs
Expand Up @@ -13,10 +13,14 @@ const historyFilePath = path.join(__dirname, '..', '..', 'HISTORY.md');
*/
function parsePRList(history) {
const prRegexp = /node-mongodb-native\/issues\/(?<prNum>\d+)\)/iu;
return history
.split('\n')
.map(line => prRegexp.exec(line)?.groups?.prNum ?? '')
.filter(prNum => prNum !== '');
return Array.from(
new Set(
history
.split('\n')
.map(line => prRegexp.exec(line)?.groups?.prNum ?? '')
.filter(prNum => prNum !== '')
)
);
}

const historyContents = await fs.readFile(historyFilePath, { encoding: 'utf8' });
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-4.x.yml
Expand Up @@ -6,6 +6,7 @@ on:
permissions:
contents: write
pull-requests: write
id-token: write

name: release-4x

Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/release-5.x.yml
@@ -0,0 +1,38 @@
on:
push:
branches: [5.x]
workflow_dispatch: {}

permissions:
contents: write
pull-requests: write
id-token: write

name: release-5x

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- id: release
uses: google-github-actions/release-please-action@v3
with:
release-type: node
package-name: mongodb
# Example: chore(main): release 5.7.0 [skip-ci]
# ${scope} - parenthesis included, base branch name
pull-request-title-pattern: 'chore${scope}: release ${version} [skip-ci]'
pull-request-header: 'Please run the release_notes action before releasing to generate release highlights'
changelog-path: HISTORY.md
default-branch: 5.x

# If release-please created a release, publish to npm
- if: ${{ steps.release.outputs.release_created }}
uses: actions/checkout@v3
- if: ${{ steps.release.outputs.release_created }}
name: actions/setup
uses: ./.github/actions/setup
- if: ${{ steps.release.outputs.release_created }}
run: npm publish --provenance --tag=5x
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5 changes: 3 additions & 2 deletions .github/workflows/release-alpha.yml
Expand Up @@ -8,13 +8,14 @@ on:
required: true
type: string

permissions:
id-token: write

name: release-alpha

jobs:
release-alpha:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- shell: bash
run: |
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/release-nightly.yml
Expand Up @@ -11,13 +11,14 @@ on:
# As long as the commit hash has changed on main a release will be published
workflow_dispatch: {}

permissions:
id-token: write

name: release-nightly

jobs:
release-nightly:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- name: actions/setup
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Expand Up @@ -6,6 +6,7 @@ on:
permissions:
contents: write
pull-requests: write
id-token: write

name: release

Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -62,7 +62,7 @@
"@microsoft/api-extractor": "^7.35.1",
"@microsoft/tsdoc-config": "^0.16.2",
"@mongodb-js/zstd": "^1.1.0",
"@octokit/core": "^4.2.1",
"@octokit/core": "^4.2.4",
"@types/chai": "^4.3.5",
"@types/chai-subset": "^1.3.3",
"@types/express": "^4.17.17",
Expand Down