From 48cbfd6b2dc74ae83359e74160502e0e15f3d2a9 Mon Sep 17 00:00:00 2001 From: Rafael Gonzaga Date: Sat, 2 Nov 2024 18:42:43 -0300 Subject: [PATCH] feat(git-node): add `--releaseDate` to `git node release` (#863) This will enable us to automate release proposal creation: https://github.com/nodejs/security-wg/issues/860 --- components/git/release.js | 4 ++++ docs/git-node.md | 6 ++++-- lib/prepare_release.js | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/components/git/release.js b/components/git/release.js index ae82e0ae..6c340bf2 100644 --- a/components/git/release.js +++ b/components/git/release.js @@ -32,6 +32,10 @@ const releaseOptions = { startLTS: { describe: 'Mark the release as the transition from Current to LTS', type: 'boolean' + }, + releaseDate: { + describe: 'Default relase date when --prepare is used. It must be YYYY-MM-DD', + type: 'string' } }; diff --git a/docs/git-node.md b/docs/git-node.md index b539a69f..3d86a1c7 100644 --- a/docs/git-node.md +++ b/docs/git-node.md @@ -224,6 +224,8 @@ Options: --security Demarcate the new security release as a security release [boolean] --startLTS Mark the release as the transition from Current to LTS [boolean] --filterLabel Filter PR by label when preparing a security release [string] + --releaseDate Default relase date when --prepare is used. + It must be YYYY-MM-DD [string] ``` ### Example @@ -462,7 +464,7 @@ It will retrieve all the triaged HackerOne reports and add creates the `vulnerab This command updates the `vulnerabilities.json` with target date of the security release. Example: - + ```sh git node security --update-date=2023/12/31 ``` @@ -471,7 +473,7 @@ Example: This command creates a pre-release announcement for the security release. Example: - + ```sh git node security --pre-release ``` diff --git a/lib/prepare_release.js b/lib/prepare_release.js index 834f8509..612ab233 100644 --- a/lib/prepare_release.js +++ b/lib/prepare_release.js @@ -25,6 +25,7 @@ export default class ReleasePreparation extends Session { this.isLTS = false; this.isLTSTransition = argv.startLTS; this.runBranchDiff = !argv.skipBranchDiff; + this.defaultReleaseDate = argv.releaseDate ?? new Date().toISOString().slice(0, 10); this.ltsCodename = ''; this.date = ''; this.filterLabels = argv.filterLabel && argv.filterLabel.split(','); @@ -241,9 +242,8 @@ export default class ReleasePreparation extends Session { cli.stopSpinner('Updated REPLACEME items in docs'); // Fetch date to use in release commit & changelogs. - const todayDate = new Date().toISOString().split('T')[0]; this.date = await cli.prompt('Enter release date in YYYY-MM-DD format:', - { questionType: 'input', defaultAnswer: todayDate }); + { questionType: 'input', defaultAnswer: this.defaultReleaseDate }); cli.startSpinner('Updating CHANGELOG.md'); await this.updateMainChangelog();