feat: --skip-announce (#2249)

This commit is contained in:
Carlos Alexandro Becker
2021-05-25 00:45:59 -03:00
committed by GitHub
parent a5ae82ae95
commit a2d7ccad2f
7 changed files with 29 additions and 4 deletions
+4 -1
View File
@@ -30,6 +30,7 @@ type releaseOpts struct {
skipPublish bool
skipSign bool
skipValidate bool
skipAnnounce bool
rmDist bool
deprecated bool
parallelism int
@@ -72,8 +73,9 @@ func newReleaseCmd() *releaseCmd {
cmd.Flags().StringVar(&root.opts.releaseNotesTmpl, "release-notes-tmpl", "", "Load custom release notes from a templated markdown file (overrides --release-notes)")
cmd.Flags().StringVar(&root.opts.releaseHeaderTmpl, "release-header-tmpl", "", "Load custom release notes header from a templated markdown file (overrides --release-header)")
cmd.Flags().StringVar(&root.opts.releaseFooterTmpl, "release-footer-tmpl", "", "Load custom release notes footer from a templated markdown file (overrides --release-footer)")
cmd.Flags().BoolVar(&root.opts.snapshot, "snapshot", false, "Generate an unversioned snapshot release, skipping all validations and without publishing any artifacts")
cmd.Flags().BoolVar(&root.opts.snapshot, "snapshot", false, "Generate an unversioned snapshot release, skipping all validations and without publishing any artifacts (implies --skip-publish, --skip-announce and --skip-validate)")
cmd.Flags().BoolVar(&root.opts.skipPublish, "skip-publish", false, "Skips publishing artifacts")
cmd.Flags().BoolVar(&root.opts.skipAnnounce, "skip-announce", false, "Skips announcing releases (implies --skip-validate)")
cmd.Flags().BoolVar(&root.opts.skipSign, "skip-sign", false, "Skips signing the artifacts")
cmd.Flags().BoolVar(&root.opts.skipValidate, "skip-validate", false, "Skips several sanity checks")
cmd.Flags().BoolVar(&root.opts.rmDist, "rm-dist", false, "Remove the dist folder before building")
@@ -122,6 +124,7 @@ func setupReleaseContext(ctx *context.Context, options releaseOpts) *context.Con
ctx.ReleaseFooterTmpl = options.releaseFooterTmpl
ctx.Snapshot = options.snapshot
ctx.SkipPublish = ctx.Snapshot || options.skipPublish
ctx.SkipAnnounce = ctx.Snapshot || options.skipPublish || options.skipAnnounce
ctx.SkipValidate = ctx.Snapshot || options.skipValidate
ctx.SkipSign = options.skipSign
ctx.RmDist = options.rmDist
+4 -2
View File
@@ -42,7 +42,8 @@ func TestReleaseFlags(t *testing.T) {
})
require.True(t, ctx.Snapshot)
require.True(t, ctx.SkipPublish)
require.True(t, ctx.SkipPublish)
require.True(t, ctx.SkipValidate)
require.True(t, ctx.SkipAnnounce)
})
t.Run("skips", func(t *testing.T) {
@@ -53,7 +54,8 @@ func TestReleaseFlags(t *testing.T) {
})
require.True(t, ctx.SkipSign)
require.True(t, ctx.SkipPublish)
require.True(t, ctx.SkipPublish)
require.True(t, ctx.SkipValidate)
require.True(t, ctx.SkipAnnounce)
})
t.Run("parallelism", func(t *testing.T) {