-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ng-dev): support exceptional minors in release publish tool
Introduces three new actions: * An action for initiating an exceptional minor. This is the point where we branch-off from the existing patch. * An action for cutting pre-releases of an exceptional minor. e.g. bumping next.0 to next.1, or rc.0 to rc.1 * An action for cutting the first RC in an exceptional minor. Also we update the existing actions: * Cut Stable: It will now take the exceptional minor, if there is one. Allowing an exceptional minor to becomethe new "patch". The base logic for how pre-releases and the first RC is cut has been a little more updated so that more code duplication can be avoided. Really a first RC action is an extension of the normal pre-releases action. This is now achieved by extending from it and overidding where needed.
- Loading branch information
1 parent
c72c9e4
commit b7beaeb
Showing
19 changed files
with
1,094 additions
and
138 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
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
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
60 changes: 60 additions & 0 deletions
60
ng-dev/release/publish/actions/exceptional-minor/cut-exceptional-minor-prerelease.ts
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {ActiveReleaseTrains} from '../../../versioning/active-release-trains.js'; | ||
import {isVersionPublishedToNpm} from '../../../versioning/npm-registry.js'; | ||
import {isFirstNextPrerelease} from '../../../versioning/prerelease-version.js'; | ||
import {CutPrereleaseBaseAction} from '../shared/cut-prerelease.js'; | ||
|
||
/** | ||
* Release action that allows for `-next` pre-releases of an in-progress | ||
* exceptional minor. The action is active when there is an exceptional minor. | ||
* | ||
* The action will bump the pre-release version to the next increment | ||
* and publish it to NPM. Note that it would not be tagged on NPM as `@next`. | ||
*/ | ||
export class CutExceptionalMinorPrereleaseAction extends CutPrereleaseBaseAction { | ||
releaseTrain = this.active.exceptionalMinor!; | ||
|
||
// An exceptional minor will never be released as `@next`. The NPM next dist tag | ||
// will be reserved for the normal FF/RC or `next` release trains. Specifically | ||
// we cannot override the `@next` NPM dist tag when it already points to a more | ||
// recent major. This would most commonly be the case, and in the other edge-case | ||
// of where no NPM next release has occurred yet- arguably an exceptional minor | ||
// should not prevent actual pre-releases for an on-going FF/RC or the next branch. | ||
// Note that NPM always requires a dist-tag, so we explicitly have one dedicated | ||
// for exceptional minors. This tag could be deleted in the future. | ||
// TODO(devversion): consider automatically deleting this tag- or keep it around. | ||
npmDistTag = 'exceptional-minor' as const; | ||
|
||
shouldUseExistingVersion = (async () => { | ||
// If an exceptional minor branch has just been created, the actual version | ||
// will not be published directly. To account for this case, based on if the | ||
// version is already published or not, the version is NOT incremented. | ||
return ( | ||
isFirstNextPrerelease(this.releaseTrain.version) && | ||
!(await isVersionPublishedToNpm(this.releaseTrain.version, this.config)) | ||
); | ||
})(); | ||
|
||
releaseNotesCompareVersion = (async () => { | ||
if (await this.shouldUseExistingVersion) { | ||
return this.active.latest.version; | ||
} | ||
return this.releaseTrain.version; | ||
})(); | ||
|
||
override async getDescription(): Promise<string> { | ||
// Make it more obvious that this action is for an exceptional minor. | ||
return `Exceptional Minor: ${await super.getDescription()}`; | ||
} | ||
|
||
static override async isActive(active: ActiveReleaseTrains) { | ||
return active.exceptionalMinor !== null; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
ng-dev/release/publish/actions/exceptional-minor/cut-exceptional-minor-release-candidate.ts
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import semver from 'semver'; | ||
import {semverInc} from '../../../../utils/semver.js'; | ||
import {ActiveReleaseTrains} from '../../../versioning/active-release-trains.js'; | ||
import {CutExceptionalMinorPrereleaseAction} from './cut-exceptional-minor-prerelease.js'; | ||
|
||
/** | ||
* Release action that allows for the first exceptional minor release-candidate. The | ||
* action is only active when there is an in-progress exceptional minor that | ||
* is still in the `-next` pre-release phase. | ||
* | ||
* The action will bump the pre-release version from the `-next` prerelease to | ||
* the first release-candidate. The action will then become inactive again as | ||
* additional RC pre-releases would be handled by `CutExceptionalMinorPrereleaseAction` | ||
* then. | ||
*/ | ||
export class CutExceptionalMinorReleaseCandidateAction extends CutExceptionalMinorPrereleaseAction { | ||
override async getDescription(): Promise<string> { | ||
// Use the RC description and make it clear that this action is for an exceptional minor. | ||
return `Exceptional Minor: ${await super.getReleaseCandidateDescription()}`; | ||
} | ||
|
||
override async getNewVersion(): Promise<semver.SemVer> { | ||
return semverInc(this.releaseTrain.version, 'prerelease', 'rc'); | ||
} | ||
|
||
static override async isActive(active: ActiveReleaseTrains) { | ||
return ( | ||
// If there is an exceptional minor and we are still in `-next` pre-releases, | ||
// the first RC pre-release can be cut. | ||
active.exceptionalMinor !== null && active.exceptionalMinor.version.prerelease[0] === 'next' | ||
); | ||
} | ||
} |
Oops, something went wrong.