Skip to content

Commit c9f6510

Browse files
committed
feat: skip release if the package has been published
1 parent 6c50480 commit c9f6510

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/Releaser.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default class Checker extends Base {
66
await super.init(tools);
77

88
const { releaseBranch } = tools.arguments;
9-
const { event, packageVersion } = this;
9+
const { event, packageVersion, latestVersion } = this;
1010

1111
if (event !== 'push') {
1212
tools.exit.neutral(`[Releaser] should be triggered by event:push`);
@@ -21,13 +21,18 @@ export default class Checker extends Base {
2121
}
2222
}
2323

24-
tools.log(' Check Commit Message');
24+
tools.log('[Releaser] check commit message');
2525
const commitMessage = await this.getCommitMessage();
2626
if (commitMessage !== `Release ${packageVersion}`) {
2727
tools.exit.neutral('[Releaser] commit message should include release proposal');
2828
return;
2929
}
3030

31+
if (packageVersion === latestVersion) {
32+
tools.exit.neutral('[Releaser] the version has been published already, skip');
33+
return;
34+
}
35+
3136
tools.log(`[Releaser] release npm package ${packageVersion}`);
3237
await this.publishNodePackage();
3338
tools.exit.success('[Releaser] done!');

0 commit comments

Comments
 (0)