-
Notifications
You must be signed in to change notification settings - Fork 6.8k
build: switch to release tool from dev-infra #23333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,20 +1,66 @@ | ||
import {join} from 'path'; | ||
import {ReleaseConfig} from '@angular/dev-infra-private/release/config'; | ||
import {releasePackages} from '../tools/release/release-output/release-packages'; | ||
import {promptAndGenerateChangelog} from '../tools/release/changelog'; | ||
import {BuiltPackage, ReleaseConfig} from '@angular/dev-infra-private/release/config'; | ||
import {ReleaseAction} from '@angular/dev-infra-private/release/publish/actions'; | ||
import {SemVer} from 'semver'; | ||
|
||
import { | ||
assertValidFrameworkPeerDependency | ||
} from '../tools/release-checks/check-framework-peer-dependency'; | ||
import { | ||
assertValidUpdateMigrationCollections | ||
} from '../tools/release-checks/check-migration-collections'; | ||
import {assertValidNpmPackageOutput} from '../tools/release-checks/npm-package-output'; | ||
|
||
const actionProto = ReleaseAction.prototype as any; | ||
const _origStageFn = actionProto.stageVersionForBranchAndCreatePullRequest; | ||
const _origVerifyFn = actionProto._verifyPackageVersions; | ||
|
||
// Patches the `@angular/dev-infra-private` release tool to perform sanity checks | ||
// before staging a release. This is temporary until the dev-infra team has implemented | ||
// a more generic solution to running sanity checks before releasing (potentially building | ||
// some of the checks we have in the components repository into the release tool). | ||
actionProto.stageVersionForBranchAndCreatePullRequest = async function(newVersion: SemVer) { | ||
await assertValidFrameworkPeerDependency(newVersion); | ||
await assertValidUpdateMigrationCollections(newVersion); | ||
|
||
return await _origStageFn.apply(this, arguments); | ||
}; | ||
|
||
// Patches the `@angular/dev-infra-private` release tool to perform sanity | ||
// checks of the NPM package output, before publishing to NPM. | ||
actionProto._verifyPackageVersions = | ||
async function(newVersion: SemVer, builtPackages: BuiltPackage[]) { | ||
await assertValidNpmPackageOutput(builtPackages, newVersion); | ||
|
||
return await _origVerifyFn.apply(this, arguments); | ||
}; | ||
|
||
/** | ||
* Packages that will be published as part of the project. | ||
* | ||
* Note: The order of packages here will control how sections | ||
* appear in the changelog. | ||
*/ | ||
export const releasePackages = [ | ||
'cdk', | ||
'material', | ||
'google-maps', | ||
'youtube-player', | ||
'cdk-experimental', | ||
'material-experimental', | ||
'material-moment-adapter', | ||
'material-luxon-adapter', | ||
'material-date-fns-adapter', | ||
]; | ||
|
||
/** Configuration for the `ng-dev release` command. */ | ||
export const release: ReleaseConfig = { | ||
releaseNotes: {useReleaseTitle: true, groupOrder: releasePackages}, | ||
publishRegistry: 'https://wombat-dressing-room.appspot.com', | ||
npmPackages: releasePackages.map(pkg => `@angular/${pkg}`), | ||
buildPackages: async () => { | ||
// The performNpmReleaseBuild function is loaded at runtime as the loading the script causes an | ||
// invocation of bazel. | ||
const {performNpmReleaseBuild} = require(join(__dirname, '../scripts/build-packages-dist')); | ||
// The `performNpmReleaseBuild` function is loaded at runtime as loading of the | ||
// script results in an invocation of Bazel for any `yarn ng-dev` command. | ||
const {performNpmReleaseBuild} = await import('../scripts/build-packages-dist'); | ||
return performNpmReleaseBuild(); | ||
}, | ||
// TODO: This can be removed once there is an org-wide tool for changelog generation. | ||
generateReleaseNotesForHead: async () => { | ||
await promptAndGenerateChangelog(join(__dirname, '../CHANGELOG.md')); | ||
}, | ||
} | ||
}; |
This file contains hidden or 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 hidden or 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,25 @@ | ||
/** | ||
* Script that builds the NPM release output for all packages | ||
* and runs sanity checks against the NPM package output. | ||
*/ | ||
|
||
import {performNpmReleaseBuild} from './build-packages-dist'; | ||
import {assertValidNpmPackageOutput} from '../tools/release-checks/npm-package-output'; | ||
import * as semver from 'semver'; | ||
|
||
const {version} = require('../package.json'); | ||
|
||
async function main() { | ||
// Build the NPM package artifacts. | ||
const builtPackages = performNpmReleaseBuild(); | ||
|
||
// Run the release output validation checks. | ||
await assertValidNpmPackageOutput(builtPackages, semver.parse(version)!); | ||
} | ||
|
||
main().catch(e => { | ||
console.error(e); | ||
process.exit(1); | ||
}); | ||
|
||
|
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.