Skip to content
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

fix(release-script): Add the generation of changelog for the release #2333

Merged
merged 4 commits into from
Sep 14, 2017
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
41 changes: 41 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
<a name="2.1.3"></a>
## [2.1.3](https://github.com/algolia/instantsearch.js/compare/v2.1.2...v2.1.3) (2017-09-05)


### Bug Fixes

* **Pagination:** add `autohideContainerHOC` to <Pagination /> ([#2296](https://github.com/algolia/instantsearch.js/issues/2296)) ([545f076](https://github.com/algolia/instantsearch.js/commit/545f076))
* **sffv:** no error when not providing noResults and no results ([#2310](https://github.com/algolia/instantsearch.js/issues/2310)) ([cc02b71](https://github.com/algolia/instantsearch.js/commit/cc02b71)), closes [#2087](https://github.com/algolia/instantsearch.js/issues/2087)



<a name="2.1.2"></a>
## [2.1.2](https://github.com/algolia/instantsearch.js/compare/v2.1.1...v2.1.2) (2017-08-24)


### Bug Fixes

* **es:** wrong path to files ([#2295](https://github.com/algolia/instantsearch.js/issues/2295)) ([a437e19](https://github.com/algolia/instantsearch.js/commit/a437e19))



<a name="2.1.1"></a>
## [2.1.1](https://github.com/algolia/instantsearch.js/compare/v2.1.0...v2.1.1) (2017-08-23)


### Bug Fixes

* **build:** provide unminified css as well ([#2292](https://github.com/algolia/instantsearch.js/issues/2292)) ([a79e067](https://github.com/algolia/instantsearch.js/commit/a79e067))



<a name="2.1.0"></a>
# [2.1.0](https://github.com/algolia/instantsearch.js/compare/v2.1.0-beta.4...v2.1.0) (2017-08-21)


### Bug Fixes

* **nvmrc:** upgrade nodejs version ([#2291](https://github.com/algolia/instantsearch.js/issues/2291)) ([94529d4](https://github.com/algolia/instantsearch.js/commit/94529d4))



<a name="2.0.2"></a>
## [2.0.2](https://github.com/algolia/instantsearch.js/compare/v2.0.1...v2.0.2) (2017-07-24)

Expand Down
29 changes: 29 additions & 0 deletions scripts/conventionalChangelog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* eslint-disable import/no-commonjs */

module.exports = {
showChangelog,
updateChangelog,
getChangelog,
};

const colors = require('colors/safe');

const baseConvChangelog = 'conventional-changelog -p angular';

function showChangelog(shell) {
shell.echo(colors.yellow.underline('\nNext version changelog:'));
const changelog = shell.exec(`${baseConvChangelog} -u`, { silent: true })
.stdout;
shell.echo(colors.white(changelog));
}

function updateChangelog(shell) {
shell.echo(colors.yellow('⚠️ Updating changelog'));
shell.exec(`${baseConvChangelog} --infile CHANGELOG.md --same-file`, {
silent: true,
});
}

function getChangelog(shell) {
return shell.exec(baseConvChangelog, { silent: true }).stdout.trim();
}
25 changes: 14 additions & 11 deletions scripts/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ const inquirer = require('inquirer');
const shell = require('shelljs');
shell.fatal = true;

const {
updateChangelog,
getChangelog,
showChangelog,
} = require('./conventionalChangelog.js');

// check if user can publish new version to npm
const { code: isNotOwner } = shell.exec('$(npm owner add `npm whoami`)', {
silent: true,
Expand Down Expand Up @@ -124,6 +130,8 @@ inquirer
`)
);

showChangelog(shell);

inquirer
.prompt([
{
Expand Down Expand Up @@ -156,17 +164,7 @@ inquirer

// update changelog
shell.echo(colors.blue('Update changelog'));
const changelog = shell
.exec('conventional-changelog -p angular')
.toString()
.trim();

shell.echo('\nNext version changelog:');
const changelogContent = shell.exec(
'conventional-changelog -u -n scripts/conventional-changelog/',
{ silent: true }
);
shell.echo(colors.white(changelogContent));
const changelog = getChangelog(shell);

// regenerate README TOC
shell.echo(colors.blue('Generate TOCS'));
Expand All @@ -175,6 +173,11 @@ inquirer
// regenerate yarn.lock
shell.exec('yarn');

// Update the changelog if stable
if (strategy === 'stable') {
updateChangelog(shell);
}

// git add and tag
const commitMessage = `v${newVersion}\n\n${changelog}`;
shell.exec(
Expand Down
2 changes: 1 addition & 1 deletion scripts/validate-commit-msgs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ for sha in `git log --format=oneline "$RANGE" | cut '-d ' -f1`; do
EXIT=2
elif echo $FIRST_LINE | grep -qE '^Merge (pull request|branch)'; then
echo "OK (merge)"
elif echo $FIRST_LINE | grep -qE '^(feat|fix|docs?|style|refactor|perf|tests?|chore|revert)\(.+\): .*'; then
elif echo $FIRST_LINE | grep -qE '^(feat|fix|docs?|style|refactor|perf|tests?|chore|revert)(\(.+\))?: .*'; then
echo "OK"
else
echo "KO (format): $FIRST_LINE"
Expand Down