Skip to content

build: run release output validations on circle #14716

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.0",
Expand Down
33 changes: 33 additions & 0 deletions tools/release/check-release-output.ts
Original file line number Diff line number Diff line change
@@ -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'));
}
25 changes: 3 additions & 22 deletions tools/release/publish-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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.
Expand Down