From fd96fc7a1eab3d98db540e8ff28391bcc2b9bf42 Mon Sep 17 00:00:00 2001 From: Andrew Lisowski Date: Wed, 18 Nov 2020 15:51:54 -0800 Subject: [PATCH] add dry-run info to afterShipIt hook --- docs/pages/docs/plugins/release-lifecycle-hooks.mdx | 1 + packages/core/src/auto.ts | 3 ++- plugins/gradle/src/index.ts | 4 ++-- plugins/maven/src/index.ts | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/pages/docs/plugins/release-lifecycle-hooks.mdx b/docs/pages/docs/plugins/release-lifecycle-hooks.mdx index 63743998d..fee94eb23 100644 --- a/docs/pages/docs/plugins/release-lifecycle-hooks.mdx +++ b/docs/pages/docs/plugins/release-lifecycle-hooks.mdx @@ -339,6 +339,7 @@ Ran after the `shipit` command has run. - `newVersion` - The new version that was release - `commits` - the commits in the release - `context` - The type of release that was created (`latest`, `next`, `canary`, or `old`) + - `dryRun` - Whether the run is a dry run ```ts auto.hooks.afterShipIt.tap("MyPlugin", async ({ context }) => { diff --git a/packages/core/src/auto.ts b/packages/core/src/auto.ts index bc17073be..4af2cdefa 100644 --- a/packages/core/src/auto.ts +++ b/packages/core/src/auto.ts @@ -153,7 +153,7 @@ export interface IAutoHooks { /** Ran after the `shipit` command has run. */ afterShipIt: AsyncParallelHook< [ - { + DryRunOption & { /** The version published in the shipit run */ newVersion: string | undefined; /** The commits the version was published for */ @@ -1532,6 +1532,7 @@ export default class Auto { newVersion, commitsInRelease, context, + dryRun: args.dryRun, }); } diff --git a/plugins/gradle/src/index.ts b/plugins/gradle/src/index.ts index 94f444c87..52c562932 100644 --- a/plugins/gradle/src/index.ts +++ b/plugins/gradle/src/index.ts @@ -238,8 +238,8 @@ export default class GradleReleasePluginPlugin implements IPlugin { ]); }); - auto.hooks.afterShipIt.tapPromise(this.name, async () => { - if (!this.snapshotRelease) { + auto.hooks.afterShipIt.tapPromise(this.name, async ({ dryRun }) => { + if (!this.snapshotRelease || dryRun) { return; } diff --git a/plugins/maven/src/index.ts b/plugins/maven/src/index.ts index b2f5c1b8f..2fc129cc8 100644 --- a/plugins/maven/src/index.ts +++ b/plugins/maven/src/index.ts @@ -277,8 +277,8 @@ export default class MavenPlugin implements IPlugin { ]); }); - auto.hooks.afterShipIt.tapPromise(this.name, async () => { - if (!this.snapshotRelease) { + auto.hooks.afterShipIt.tapPromise(this.name, async ({ dryRun }) => { + if (!this.snapshotRelease || dryRun) { return; }