-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
508b0f1
commit 2f3357e
Showing
6 changed files
with
68 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,44 @@ | ||
const { readFileSync } = require('fs'); | ||
const { join } = require('path'); | ||
const { readFileSync } = require("fs"); | ||
const { join } = require("path"); | ||
|
||
const args = process.argv.slice(2); | ||
if (args.length != 3) { | ||
console.error(`usage: generate_release.js <package> <branch> <npm tag>`); | ||
process.exit(1); | ||
if (!(args.length === 3 || args.length === 4)) { | ||
console.error( | ||
`usage: generate_release.js <package> <branch> <npm tag> <optional silk asset group>`, | ||
); | ||
process.exit(1); | ||
} | ||
|
||
const [package, branch, tag] = args; | ||
const [package, branch, tag, assetGroup] = args; | ||
|
||
const isNative = package === 'kerberos' || package === 'mongodb-client-encryption'; | ||
const template = readFileSync(join(__dirname, isNative ? './native_release_template.yml' : './release_template.yml'), 'utf-8'); | ||
const isNative = | ||
package === "kerberos" || package === "mongodb-client-encryption"; | ||
const template = readFileSync( | ||
join(__dirname, "./release_template.yml"), | ||
"utf-8", | ||
); | ||
|
||
const EVERGREEN_PROJECTS = { | ||
'mongodb': 'mongo-node-driver-next', | ||
'bson': 'js-bson' | ||
mongodb: "mongo-node-driver-next", | ||
bson: "js-bson", | ||
}; | ||
|
||
const generated = template.replaceAll('RELEASE_BRANCH', branch) | ||
.replaceAll('RELEASE_PACKAGE', package) | ||
.replaceAll('RELEASE_TAG', tag) | ||
.replaceAll('EVERGREEN_PROJECT', EVERGREEN_PROJECTS[package] ?? ''); | ||
const generated = template | ||
.replaceAll("RELEASE_BRANCH", branch) | ||
.replaceAll("RELEASE_PACKAGE", package) | ||
.replaceAll("RELEASE_TAG", tag) | ||
.replaceAll("EVERGREEN_PROJECT", EVERGREEN_PROJECTS[package] ?? "") | ||
.replaceAll("IGNORE_INSTALL_SCRIPTS", isNative) | ||
.replaceAll("SILK_ASSET_GROUP", assetGroup ?? "''"); | ||
|
||
const project = EVERGREEN_PROJECTS[package]; | ||
if (!project) { | ||
const final = generated.split('\n').filter(line => !line.includes("evergreen")).join('\n'); | ||
process.stdout.write(final); | ||
process.exit(); | ||
const final = generated | ||
.split("\n") | ||
.filter((line) => !line.includes("evergreen")) | ||
.join("\n"); | ||
process.stdout.write(final); | ||
process.exit(); | ||
} | ||
|
||
process.stdout.write(generated); | ||
process.stdout.write(generated); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
name: Publish Release Asset to S3 | ||
description: "Publish Asset to S3" | ||
inputs: | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
name: Setup | ||
description: 'Installs node, driver dependencies, and builds source' | ||
inputs: | ||
description: "Installs node, driver dependencies, and builds source" | ||
inputs: | ||
ignore_install_scripts: | ||
description: Should we ignore postinstall scripts? | ||
default: 'false' | ||
default: "false" | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 'lts/*' | ||
cache: 'npm' | ||
registry-url: 'https://registry.npmjs.org' | ||
node-version: "lts/*" | ||
cache: "npm" | ||
registry-url: "https://registry.npmjs.org" | ||
- run: npm install -g npm@latest | ||
shell: bash | ||
- run: npm clean-install | ||
if: ${{ inputs.ignore_install_scripts == 'false' }} | ||
shell: bash | ||
- run: npm clean-install --ignore-scripts | ||
if: ${{ inputs.ignore_install_scripts == 'true' }} | ||
shell: bash | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters