diff --git a/doc/contributing/releases.md b/doc/contributing/releases.md index c214f8c97cc5..2570e526e333 100644 --- a/doc/contributing/releases.md +++ b/doc/contributing/releases.md @@ -430,6 +430,7 @@ already defined in `src/node_version.h`: #define NODE_PATCH_VERSION z // And for alpha releases: +#define NODE_VERSION_IS_ALPHA 1 #define NODE_ALPHA_MAJOR_VERSION a #define NODE_ALPHA_MINOR_VERSION b #define NODE_ALPHA_PATCH_VERSION c @@ -445,8 +446,7 @@ be produced with a version string that does not have a trailing pre-release tag:
Major version release -Remove the `NODE_ALPHA_MAJOR_VERSION`, `NODE_ALPHA_MINOR_VERSION`, and -`NODE_ALPHA_PATCH_VERSION` macros. +Set the `NODE_VERSION_IS_ALPHA` macro value to `0`.
@@ -989,9 +989,9 @@ edit it instead and: * Increment `NODE_MAJOR_VERSION` by one. * Reset `NODE_PATCH_VERSION` and `NODE_MINOR_VERSION` to `0`. -* Set `NODE_ALPHA_MAJOR_VERSION`, `NODE_ALPHA_MINOR_VERSION`, and - `NODE_ALPHA_PATCH_VERSION` back to `0` (`main` should already have this, the - release commit will have them removed). +* Set `NODE_VERSION_IS_ALPHA`, `NODE_ALPHA_MAJOR_VERSION`, + `NODE_ALPHA_MINOR_VERSION`, and `NODE_ALPHA_PATCH_VERSION` back to `0` + (`main` should already have this). * Change `NODE_VERSION_IS_RELEASE` back to `0`. Amend the current commit to apply the changes: @@ -1532,8 +1532,7 @@ in the next major release line. To mark a release line as stable, the following changes must be made to `src/node_version.h`: -* Remove `NODE_ALPHA_MAJOR_VERSION`, `NODE_ALPHA_MINOR_VERSION`, and - `NODE_ALPHA_PATCH_VERSION`. +* Set `NODE_VERSION_IS_ALPHA` to `0`. #### Generate the notable changes diff --git a/src/node_version.h b/src/node_version.h index 8c94ce8ec7f3..af6d56caddd5 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -31,6 +31,7 @@ #define NODE_VERSION_IS_RELEASE 0 +#define NODE_VERSION_IS_ALPHA 0 #define NODE_ALPHA_MAJOR_VERSION 0 #define NODE_ALPHA_MINOR_VERSION 0 #define NODE_ALPHA_PATCH_VERSION 0 @@ -46,13 +47,13 @@ #ifndef NODE_TAG #if NODE_VERSION_IS_RELEASE -#ifdef NODE_ALPHA_MAJOR_VERSION +#if NODE_VERSION_IS_ALPHA #define NODE_TAG \ "-alpha." NODE_STRINGIFY(NODE_ALPHA_MAJOR_VERSION) "." NODE_STRINGIFY( \ NODE_ALPHA_MINOR_VERSION) "." NODE_STRINGIFY(NODE_ALPHA_PATCH_VERSION) #else #define NODE_TAG "" -#endif // NODE_ALPHA_MAJOR_VERSION +#endif // NODE_VERSION_IS_ALPHA #else // NODE_VERSION_IS_RELEASE #define NODE_TAG "-pre" #endif // NODE_VERSION_IS_RELEASE diff --git a/test/parallel/test-release-changelog.js b/test/parallel/test-release-changelog.js index 6b8e6ece43af..f35d0dae9f37 100644 --- a/test/parallel/test-release-changelog.js +++ b/test/parallel/test-release-changelog.js @@ -36,6 +36,15 @@ if (lts) { assert.notStrictEqual(codename, ''); } +const alpha = getDefine(versionText, 'NODE_VERSION_IS_ALPHA') !== '0'; +// The alpha tag should only be present if the alpha bit is set. +const alphaTag = alpha ? + `-alpha.${getDefine(versionText, 'NODE_ALPHA_MAJOR_VERSION')}` + + `.${getDefine(versionText, 'NODE_ALPHA_MINOR_VERSION')}` + + `.${getDefine(versionText, 'NODE_ALPHA_PATCH_VERSION')}` : + ''; +assert.strictEqual(process.version, `v${major}.${minor}.${patch}${alphaTag}`); + const changelogPath = `doc/changelogs/CHANGELOG_V${major}.md`; // Check CHANGELOG_V*.md {