Skip to content

Commit 48cbfd6

Browse files
authored
feat(git-node): add --releaseDate to git node release (#863)
This will enable us to automate release proposal creation: nodejs/security-wg#860
1 parent 9a40d21 commit 48cbfd6

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

components/git/release.js

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ const releaseOptions = {
3232
startLTS: {
3333
describe: 'Mark the release as the transition from Current to LTS',
3434
type: 'boolean'
35+
},
36+
releaseDate: {
37+
describe: 'Default relase date when --prepare is used. It must be YYYY-MM-DD',
38+
type: 'string'
3539
}
3640
};
3741

docs/git-node.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@ Options:
224224
--security Demarcate the new security release as a security release [boolean]
225225
--startLTS Mark the release as the transition from Current to LTS [boolean]
226226
--filterLabel Filter PR by label when preparing a security release [string]
227+
--releaseDate Default relase date when --prepare is used.
228+
It must be YYYY-MM-DD [string]
227229
```
228230

229231
### Example
@@ -462,7 +464,7 @@ It will retrieve all the triaged HackerOne reports and add creates the `vulnerab
462464

463465
This command updates the `vulnerabilities.json` with target date of the security release.
464466
Example:
465-
467+
466468
```sh
467469
git node security --update-date=2023/12/31
468470
```
@@ -471,7 +473,7 @@ Example:
471473

472474
This command creates a pre-release announcement for the security release.
473475
Example:
474-
476+
475477
```sh
476478
git node security --pre-release
477479
```

lib/prepare_release.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export default class ReleasePreparation extends Session {
2525
this.isLTS = false;
2626
this.isLTSTransition = argv.startLTS;
2727
this.runBranchDiff = !argv.skipBranchDiff;
28+
this.defaultReleaseDate = argv.releaseDate ?? new Date().toISOString().slice(0, 10);
2829
this.ltsCodename = '';
2930
this.date = '';
3031
this.filterLabels = argv.filterLabel && argv.filterLabel.split(',');
@@ -241,9 +242,8 @@ export default class ReleasePreparation extends Session {
241242
cli.stopSpinner('Updated REPLACEME items in docs');
242243

243244
// Fetch date to use in release commit & changelogs.
244-
const todayDate = new Date().toISOString().split('T')[0];
245245
this.date = await cli.prompt('Enter release date in YYYY-MM-DD format:',
246-
{ questionType: 'input', defaultAnswer: todayDate });
246+
{ questionType: 'input', defaultAnswer: this.defaultReleaseDate });
247247

248248
cli.startSpinner('Updating CHANGELOG.md');
249249
await this.updateMainChangelog();

0 commit comments

Comments
 (0)