Skip to content

Commit 2f3357e

Browse files
prettier changes
1 parent 508b0f1 commit 2f3357e

File tree

6 files changed

+68
-137
lines changed

6 files changed

+68
-137
lines changed

node/generate_release.js

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,44 @@
1-
const { readFileSync } = require('fs');
2-
const { join } = require('path');
1+
const { readFileSync } = require("fs");
2+
const { join } = require("path");
33

44
const args = process.argv.slice(2);
5-
if (args.length != 3) {
6-
console.error(`usage: generate_release.js <package> <branch> <npm tag>`);
7-
process.exit(1);
5+
if (!(args.length === 3 || args.length === 4)) {
6+
console.error(
7+
`usage: generate_release.js <package> <branch> <npm tag> <optional silk asset group>`,
8+
);
9+
process.exit(1);
810
}
911

10-
const [package, branch, tag] = args;
12+
const [package, branch, tag, assetGroup] = args;
1113

12-
const isNative = package === 'kerberos' || package === 'mongodb-client-encryption';
13-
const template = readFileSync(join(__dirname, isNative ? './native_release_template.yml' : './release_template.yml'), 'utf-8');
14+
const isNative =
15+
package === "kerberos" || package === "mongodb-client-encryption";
16+
const template = readFileSync(
17+
join(__dirname, "./release_template.yml"),
18+
"utf-8",
19+
);
1420

1521
const EVERGREEN_PROJECTS = {
16-
'mongodb': 'mongo-node-driver-next',
17-
'bson': 'js-bson'
22+
mongodb: "mongo-node-driver-next",
23+
bson: "js-bson",
1824
};
1925

20-
const generated = template.replaceAll('RELEASE_BRANCH', branch)
21-
.replaceAll('RELEASE_PACKAGE', package)
22-
.replaceAll('RELEASE_TAG', tag)
23-
.replaceAll('EVERGREEN_PROJECT', EVERGREEN_PROJECTS[package] ?? '');
26+
const generated = template
27+
.replaceAll("RELEASE_BRANCH", branch)
28+
.replaceAll("RELEASE_PACKAGE", package)
29+
.replaceAll("RELEASE_TAG", tag)
30+
.replaceAll("EVERGREEN_PROJECT", EVERGREEN_PROJECTS[package] ?? "")
31+
.replaceAll("IGNORE_INSTALL_SCRIPTS", isNative)
32+
.replaceAll("SILK_ASSET_GROUP", assetGroup ?? "''");
2433

2534
const project = EVERGREEN_PROJECTS[package];
2635
if (!project) {
27-
const final = generated.split('\n').filter(line => !line.includes("evergreen")).join('\n');
28-
process.stdout.write(final);
29-
process.exit();
36+
const final = generated
37+
.split("\n")
38+
.filter((line) => !line.includes("evergreen"))
39+
.join("\n");
40+
process.stdout.write(final);
41+
process.exit();
3042
}
3143

32-
process.stdout.write(generated);
44+
process.stdout.write(generated);

node/get_version_info/action.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
name: Publish Release Asset to S3
32
description: "Publish Asset to S3"
43
inputs:

node/native_release_template.yml

Lines changed: 0 additions & 96 deletions
This file was deleted.

node/release_template.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,13 @@ jobs:
2121
with:
2222
target-branch: RELEASE_BRANCH
2323

24-
ssdlc:
24+
build:
2525
needs: [release_please]
26+
name: "Perform any build or bundling steps, as necessary."
27+
uses: ./.github/workflows/build.yml
28+
29+
ssdlc:
30+
needs: [release_please, build]
2631
permissions:
2732
# required for all workflows
2833
security-events: write
@@ -35,6 +40,8 @@ jobs:
3540

3641
- name: Install Node and dependencies
3742
uses: baileympearson/drivers-github-tools/node/setup@add-signing-env-action-for-node
43+
with:
44+
ignore_install_scripts: IGNORE_INSTALL_SCRIPTS
3845

3946
- name: Load version and package info
4047
uses: baileympearson/drivers-github-tools/node/get_version_info@add-signing-env-action-for-node
@@ -52,8 +59,17 @@ jobs:
5259

5360
- name: Copy sbom file to release assets
5461
shell: bash
62+
if: ${{ SILK_ASSET_GROUP == '' }}
5563
run: cp sbom.json ${{ env.S3_ASSETS }}/sbom.json
5664

65+
# only used for mongodb-client-encryption
66+
- name: Augment SBOM and copy to release assets
67+
if: ${{ SILK_ASSET_GROUP != '' }}
68+
uses: mongodb-labs/drivers-github-tools/sbom@v2
69+
with:
70+
silk_asset_group: ${{ SILK_ASSET_GROUP }}
71+
sbom_file_name: sbom.json
72+
5773
- name: Generate authorized pub report
5874
uses: mongodb-labs/drivers-github-tools/full-report@v2
5975
with:
@@ -62,7 +78,7 @@ jobs:
6278
sarif_report_target_ref: RELEASE_BRANCH
6379
third_party_dependency_tool: n/a
6480
dist_filenames: artifacts/*
65-
token: ${{ github.token }}
81+
token: ${{ github.token }}
6682
sbom_file_name: sbom.json
6783
evergreen_project: EVERGREEN_PROJECT
6884
evergreen_commit: ${{ env.commit }}
@@ -74,7 +90,7 @@ jobs:
7490
dry_run: ${{ needs.release_please.outputs.release_created == '' }}
7591

7692
publish:
77-
needs: [release_please, ssdlc]
93+
needs: [release_please, ssdlc, build]
7894
environment: release
7995
runs-on: ubuntu-latest
8096
steps:

node/setup/action.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
name: Setup
2-
description: 'Installs node, driver dependencies, and builds source'
3-
inputs:
2+
description: "Installs node, driver dependencies, and builds source"
3+
inputs:
44
ignore_install_scripts:
55
description: Should we ignore postinstall scripts?
6-
default: 'false'
6+
default: "false"
77

88
runs:
99
using: composite
1010
steps:
1111
- uses: actions/setup-node@v4
1212
with:
13-
node-version: 'lts/*'
14-
cache: 'npm'
15-
registry-url: 'https://registry.npmjs.org'
13+
node-version: "lts/*"
14+
cache: "npm"
15+
registry-url: "https://registry.npmjs.org"
1616
- run: npm install -g npm@latest
1717
shell: bash
1818
- run: npm clean-install
1919
if: ${{ inputs.ignore_install_scripts == 'false' }}
2020
shell: bash
2121
- run: npm clean-install --ignore-scripts
2222
if: ${{ inputs.ignore_install_scripts == 'true' }}
23-
shell: bash
23+
shell: bash

node/sign_node_package/action.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
name: Compress, Sign and Upload to GH Release
2-
description: 'Compresses package and signs with garasign and uploads to GH release'
2+
description: "Compresses package and signs with garasign and uploads to GH release"
33

4-
inputs:
4+
inputs:
55
aws_role_arn:
6-
description: 'AWS role input for drivers-github-tools/gpg-sign@v2'
6+
description: "AWS role input for drivers-github-tools/gpg-sign@v2"
77
required: true
88
aws_region_name:
9-
description: 'AWS region name input for drivers-github-tools/gpg-sign@v2'
9+
description: "AWS region name input for drivers-github-tools/gpg-sign@v2"
1010
required: true
1111
aws_secret_id:
12-
description: 'AWS secret id input for drivers-github-tools/gpg-sign@v2'
12+
description: "AWS secret id input for drivers-github-tools/gpg-sign@v2"
1313
required: true
1414
npm_package_name:
15-
description: 'The name for the npm package this repository represents'
15+
description: "The name for the npm package this repository represents"
1616
required: true
1717
dry_run:
18-
description: 'Should we upload files to the release?'
18+
description: "Should we upload files to the release?"
1919
required: false
20-
default: 'true'
20+
default: "true"
2121
artifact_directory:
2222
description: The directory in which to output signatures.
2323
default: artifacts
@@ -45,7 +45,7 @@ runs:
4545

4646
- name: Set up drivers-github-tools
4747
uses: mongodb-labs/drivers-github-tools/setup@v2
48-
with:
48+
with:
4949
aws_region_name: ${{ inputs.aws_region_name }}
5050
aws_role_arn: ${{ inputs.aws_role_arn }}
5151
aws_secret_id: ${{ inputs.aws_secret_id }}
@@ -70,9 +70,9 @@ runs:
7070
7171
- name: Create detached signature
7272
uses: baileympearson/drivers-github-tools/gpg-sign@add-signing-env-action-for-node
73-
with:
73+
with:
7474
filenames: ${{ env.FILES_TO_SIGN }}
75-
env:
75+
env:
7676
RELEASE_ASSETS: ${{ inputs.artifact_directory }}
7777

7878
- name: Copy the tarballs to the artifacts directory
@@ -88,4 +88,4 @@ runs:
8888
run: gh release upload v${{ env.package_version }} artifacts/*.*
8989
shell: bash
9090
env:
91-
GH_TOKEN: ${{ github.token }}
91+
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)