feat: custom release notes (#32191)
feat: custom release notes (#32172) (cherry picked from commit b620efba388bf4a85081e1d07fc86f80d4d4b83c) Co-authored-by: Jason Rasmussen <jason@rasm.me>
This commit is contained in:
1 parent
c6c8e516d7
commit
1c284cd4ef
8 files changed
+631
-7
No files matched your search
@@ -1,4 +1,10 @@
|
||||
import { Command, Option } from 'commander';
|
||||
import {
|
||||
GitClient,
|
||||
GitHubClient,
|
||||
type NotesOptions,
|
||||
NotesService,
|
||||
} from './commands/notes';
|
||||
import { handleRelease } from './commands/release';
|
||||
import {
|
||||
RELEASE_TYPES,
|
||||
@@ -43,5 +49,29 @@ export const cli = (argv: string[]) => {
|
||||
}
|
||||
});
|
||||
|
||||
program
|
||||
.command('notes')
|
||||
.description('generate release notes for a tag')
|
||||
.requiredOption('-t, --tag <tag>', 'the tag being released')
|
||||
.requiredOption('-p, --previous <tag>', 'the previously released tag')
|
||||
.addOption(
|
||||
new Option('--token <token>', 'a GitHub token')
|
||||
.env('GH_TOKEN')
|
||||
.default(process.env.GITHUB_TOKEN, 'GITHUB_TOKEN')
|
||||
.makeOptionMandatory(),
|
||||
)
|
||||
.action(async ({ token, ...options }: NotesOptions & { token: string }) => {
|
||||
try {
|
||||
const service = new NotesService(
|
||||
new GitClient(),
|
||||
new GitHubClient(token),
|
||||
);
|
||||
process.stdout.write(await service.handleNotes(options));
|
||||
} catch (error) {
|
||||
console.error(error instanceof Error ? error.message : error);
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
|
||||
return program.parse(argv);
|
||||
};
|
||||
Reference in new issue
Block a user