Skip to content

Commit

Permalink
chore(cli): update version of CLI on root readme (#1069)
Browse files Browse the repository at this point in the history
Fixes #684
https://coveord.atlassian.net/browse/CDX-1272

## Proposed changes

When releasing, copy the usage section from the CLI to the root readme.
Dumb but it works.

## Testing
- [x] Manual Tests: ran the function.
  • Loading branch information
louis-bompart authored Jan 11, 2023
1 parent e1b54fa commit f4f54cc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,21 @@ npx @coveo/cli

To validate your CLI installation, use the `coveo --version` command:

<!-- usage -->

```sh-session
$ npm install -g @coveo/cli
$ coveo COMMAND
running command...
$ coveo (--version)
@coveo/cli/2.2.0 linux-x64 node-v18.12.1
$ coveo --help [COMMAND]
USAGE
$ coveo COMMAND
...
```
$ coveo --version
@coveo/cli/1.19.0 darwin-x64 node-v16.10.0
```

<!-- usagestop -->

## Getting started

Expand Down
13 changes: 11 additions & 2 deletions scripts/releaseV2/phase2-git-commit-tag-push.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import {Octokit} from 'octokit';
import angularChangelogConvention from 'conventional-changelog-angular';
import {dedent} from 'ts-dedent';
import {readFileSync} from 'fs';
import {readFileSync, writeFileSync} from 'fs';

const CLI_PKG_MATCHER = /^@coveo\/cli@(?<version>\d+\.\d+\.\d+)$/gm;

Expand Down Expand Up @@ -60,7 +60,7 @@ const getCliChangelog = () => {
);
await writeChangelog(PATH, changelog);
}

updateRootReadme();
await gitCommit(
dedent`
[version bump] chore(release): release ${gitNewTag} [skip ci]
Expand Down Expand Up @@ -98,3 +98,12 @@ const getCliChangelog = () => {
body: releaseBody,
});
})();

function updateRootReadme() {
const usageRegExp = /^<!-- usage -->(.|\n)*<!-- usagestop -->$/m;
const cliReadme = readFileSync('packages/cli/core/README.md', 'utf-8');
let rootReadme = readFileSync('README.md');
const cliUsage = usageRegExp.exec(cliReadme);
rootReadme.replace(usageRegExp, cliUsage[0]);
writeFileSync('README.md', rootReadme);
}

0 comments on commit f4f54cc

Please sign in to comment.