build: run release output validations on circle (#14716)

* Runs the release output validations on CircleCI after all release packages have been built.

Closes #12877
This commit is contained in:
Paul Gschwendtner
2019-01-09 19:44:11 +01:00
committed by Andrew Seguin
parent ec9f9c836c
commit aad9876403
5 changed files with 38 additions and 22 deletions
+1
View File
@@ -246,6 +246,7 @@ jobs:
- *yarn_install
- run: yarn gulp ci:build-release-packages
- run: yarn check-release-output
# Store the release output in the workspace storage. This means that other jobs
# in the same workflow can attach the release output to their job.
+1
View File
@@ -25,6 +25,7 @@
"gulp": "gulp",
"stage-release": "ts-node --project tools/release/ tools/release/stage-release.ts",
"publish-release": "ts-node --project tools/release/ tools/release/publish-release.ts",
"check-release-output": "ts-node --project tools/release tools/release/check-release-output.ts",
"preinstall": "node ./tools/npm/check-npm.js"
},
"version": "7.2.1",
+33
View File
@@ -0,0 +1,33 @@
import {green, red} from 'chalk';
import {join} from 'path';
import {checkReleasePackage} from './release-output/check-package';
import {releasePackages} from './release-output/release-packages';
/**
* Checks the release output by running the release-output validations for each
* release package.
*/
export function checkReleaseOutput(releaseOutputDir: string) {
let hasFailed = false;
releasePackages.forEach(packageName => {
if (!checkReleasePackage(releaseOutputDir, packageName)) {
hasFailed = true;
}
});
// In case any release validation did not pass, abort the publishing because
// the issues need to be resolved before publishing.
if (hasFailed) {
console.error(red(` ✘ Release output does not pass all release validations. Please fix ` +
`all failures or reach out to the team.`));
process.exit(1);
}
console.info(green(` ✓ Release output passed validation checks.`));
}
if (require.main === module) {
checkReleaseOutput(join(__dirname, '../../dist/releases'));
}
+3 -22
View File
@@ -3,12 +3,12 @@ import {execSync} from 'child_process';
import {readFileSync} from 'fs';
import {join} from 'path';
import {BaseReleaseTask} from './base-release-task';
import {checkReleaseOutput} from './check-release-output';
import {extractReleaseNotes} from './extract-release-notes';
import {GitClient} from './git/git-client';
import {getGithubReleasesUrl} from './git/github-urls';
import {isNpmAuthenticated, runInteractiveNpmLogin, runNpmPublish} from './npm/npm-client';
import {promptForNpmDistTag} from './prompt/npm-dist-tag-prompt';
import {checkReleasePackage} from './release-output/check-packages';
import {releasePackages} from './release-output/release-packages';
import {CHANGELOG_FILE_NAME} from './stage-release';
import {parseVersionName, Version} from './version-name/parse-version';
@@ -87,8 +87,8 @@ class PublishReleaseTask extends BaseReleaseTask {
this.buildReleasePackages();
console.info(green(` ✓ Built the release output.`));
this.checkReleaseOutput();
console.info(green(` ✓ Release output passed validation checks.`));
// Checks all release packages against release output validations before releasing.
checkReleaseOutput(this.releaseOutputPath);
// Extract the release notes for the new version from the changelog file.
const releaseNotes = extractReleaseNotes(
@@ -145,25 +145,6 @@ class PublishReleaseTask extends BaseReleaseTask {
spawnOptions);
}
/** Checks the release output by running the release-output validations. */
private checkReleaseOutput() {
let hasFailed = false;
releasePackages.forEach(packageName => {
if (!checkReleasePackage(this.releaseOutputPath, packageName)) {
hasFailed = true;
}
});
// In case any release validation did not pass, abort the publishing because
// the issues need to be resolved before publishing.
if (hasFailed) {
console.error(red(` ✘ Release output does not pass all release validations. Please fix ` +
`all failures or reach out to the team.`));
process.exit(1);
}
}
/**
* Prompts the user whether they are sure that the current stable version should be
* released to the "next" NPM dist-tag.