@@ -128,8 +128,9 @@ The version string must use the same format as Go tags.`,
128
128
minorVersion .Example = "go1.18.2"
129
129
v1 := wd .Parameter (minorVersion )
130
130
v2 := wd .Parameter (workflow.Parameter {
131
- Name : "Secondary Version" ,
132
- Doc : `Secondary Version is an older Go version that was also released.` ,
131
+ Name : "Secondary Version (optional)" ,
132
+ Doc : `Secondary Version is an older Go version that was also released,
133
+ or the empty string if only one minor release was made.` ,
133
134
Example : "go1.17.10" ,
134
135
})
135
136
securitySummary := wd .Parameter (securitySummaryParameter )
@@ -334,8 +335,9 @@ This is CVE-2022-24675 and Go issue https://go.dev/issue/51853.`,
334
335
minorVersion := version
335
336
minorVersion .Example = "go1.18.2"
336
337
secondaryVersion := workflow.Parameter {
337
- Name : "SecondaryVersion" ,
338
- Doc : `SecondaryVersion is an older Go version that was also released.` ,
338
+ Name : "SecondaryVersion (optional)" ,
339
+ Doc : `SecondaryVersion is an older Go version that was also released,
340
+ or the empty string if only one minor release was made.` ,
339
341
Example : "go1.17.10" ,
340
342
}
341
343
@@ -418,8 +420,9 @@ It's applicable to all release types other than major
418
420
minorVersion := version
419
421
minorVersion .Example = "go1.18.2"
420
422
secondaryVersion := workflow.Parameter {
421
- Name : "SecondaryVersion" ,
422
- Doc : `SecondaryVersion is an older Go version that was also released.` ,
423
+ Name : "SecondaryVersion (optional)" ,
424
+ Doc : `SecondaryVersion is an older Go version that was also released,
425
+ or the empty string if only one minor release was made.` ,
423
426
Example : "go1.17.10" ,
424
427
}
425
428
@@ -556,8 +559,12 @@ func RegisterReleaseWorkflows(ctx context.Context, h *DefinitionHolder, build *B
556
559
for _ , r := range releases {
557
560
wd := workflow .New ()
558
561
559
- var names workflow.Value
562
+ var securitySummary , securityFixes , names workflow.Value
560
563
if mergeCommTasksIntoReleaseWorkflows {
564
+ if r .kind == task .KindCurrentMinor || r .kind == task .KindPrevMinor {
565
+ securitySummary = wd .Parameter (securitySummaryParameter )
566
+ securityFixes = wd .Parameter (securityFixesParameter )
567
+ }
561
568
names = wd .Parameter (releaseCoordinatorNames )
562
569
}
563
570
@@ -567,37 +574,7 @@ func RegisterReleaseWorkflows(ctx context.Context, h *DefinitionHolder, build *B
567
574
}
568
575
569
576
if mergeCommTasksIntoReleaseWorkflows {
570
- okayToAnnounceAndTweet := wd .Action ("Wait to Announce" , build .ApproveAction , wd .After (versionPublished ))
571
-
572
- // Announce that a new Go release has been published.
573
- sentMail := wd .Task ("mail-announcement" , func (ctx * workflow.TaskContext , v string , names []string ) (task.SentMail , error ) {
574
- switch r .kind {
575
- case task .KindMajor :
576
- return comm .AnnounceMajorRelease (ctx , task.ReleaseAnnouncement {Version : v , Names : names })
577
- case task .KindRC :
578
- return comm .AnnounceRCRelease (ctx , task.ReleaseAnnouncement {Version : v , Names : names })
579
- case task .KindBeta :
580
- return comm .AnnounceBetaRelease (ctx , task.ReleaseAnnouncement {Version : v , Names : names })
581
- default :
582
- return task.SentMail {}, fmt .Errorf ("unknown release kind %v" , r .kind )
583
- }
584
- }, versionPublished , names , wd .After (okayToAnnounceAndTweet ))
585
- announcementURL := wd .Task ("await-announcement" , comm .AwaitAnnounceMail , sentMail )
586
- tweetURL := wd .Task ("post-tweet" , func (ctx * workflow.TaskContext , v , ann string ) (string , error ) {
587
- switch r .kind {
588
- case task .KindMajor :
589
- return comm .TweetMajorRelease (ctx , task.ReleaseTweet {Version : v })
590
- case task .KindRC :
591
- return comm .TweetRCRelease (ctx , task.ReleaseTweet {Version : v , Announcement : ann })
592
- case task .KindBeta :
593
- return comm .TweetBetaRelease (ctx , task.ReleaseTweet {Version : v , Announcement : ann })
594
- default :
595
- return "" , fmt .Errorf ("unknown release kind %v" , r .kind )
596
- }
597
- }, versionPublished , announcementURL , wd .After (okayToAnnounceAndTweet ))
598
-
599
- wd .Output ("Announcement URL" , announcementURL )
600
- wd .Output ("Tweet URL" , tweetURL )
577
+ addCommTasksForSingleRelease (wd , build , comm , r .kind , versionPublished , securitySummary , securityFixes , names )
601
578
}
602
579
603
580
h .RegisterDefinition (fmt .Sprintf ("Go 1.%d %s" , r .major , r .suffix ), wd )
@@ -654,22 +631,78 @@ func createMinorReleaseWorkflow(build *BuildReleaseTasks, milestone *task.Milest
654
631
}
655
632
656
633
if mergeCommTasksIntoReleaseWorkflows {
657
- okayToAnnounceAndTweet := wd .Action ("Wait to Announce" , build .ApproveAction , wd .After (v1Published , v2Published ))
634
+ addCommTasksForDoubleMinorRelease (wd , build , comm , v1Published , v2Published , securitySummary , securityFixes , names )
635
+ }
658
636
659
- // Announce that a new Go release has been published.
660
- sentMail := wd .Task ("mail-announcement" , func (ctx * workflow.TaskContext , v1 , v2 string , sec , names []string ) (task.SentMail , error ) {
661
- return comm .AnnounceMinorRelease (ctx , task.ReleaseAnnouncement {Version : v1 , SecondaryVersion : v2 , Security : sec , Names : names })
662
- }, v1Published , v2Published , securityFixes , names , wd .After (okayToAnnounceAndTweet ))
663
- announcementURL := wd .Task ("await-announcement" , comm .AwaitAnnounceMail , sentMail )
664
- tweetURL := wd .Task ("post-tweet" , func (ctx * workflow.TaskContext , v1 , v2 , sec , ann string ) (string , error ) {
665
- return comm .TweetMinorRelease (ctx , task.ReleaseTweet {Version : v1 , SecondaryVersion : v2 , Security : sec , Announcement : ann })
666
- }, v1Published , v2Published , securitySummary , announcementURL , wd .After (okayToAnnounceAndTweet ))
637
+ return wd , nil
638
+ }
667
639
668
- wd .Output ("Announcement URL" , announcementURL )
669
- wd .Output ("Tweet URL" , tweetURL )
640
+ func addCommTasksForDoubleMinorRelease (
641
+ wd * workflow.Definition , build * BuildReleaseTasks , comm task.CommunicationTasks ,
642
+ v1Published , v2Published , securitySummary , securityFixes , names workflow.Value ,
643
+ ) {
644
+ okayToAnnounceAndTweet := wd .Action ("Wait to Announce" , build .ApproveAction , wd .After (v1Published , v2Published ))
645
+
646
+ // Announce that a new Go release has been published.
647
+ sentMail := wd .Task ("mail-announcement" , func (ctx * workflow.TaskContext , v1 , v2 string , sec , names []string ) (task.SentMail , error ) {
648
+ return comm .AnnounceMinorRelease (ctx , task.ReleaseAnnouncement {Version : v1 , SecondaryVersion : v2 , Security : sec , Names : names })
649
+ }, v1Published , v2Published , securityFixes , names , wd .After (okayToAnnounceAndTweet ))
650
+ announcementURL := wd .Task ("await-announcement" , comm .AwaitAnnounceMail , sentMail )
651
+ tweetURL := wd .Task ("post-tweet" , func (ctx * workflow.TaskContext , v1 , v2 , sec , ann string ) (string , error ) {
652
+ return comm .TweetMinorRelease (ctx , task.ReleaseTweet {Version : v1 , SecondaryVersion : v2 , Security : sec , Announcement : ann })
653
+ }, v1Published , v2Published , securitySummary , announcementURL , wd .After (okayToAnnounceAndTweet ))
654
+
655
+ wd .Output ("Announcement URL" , announcementURL )
656
+ wd .Output ("Tweet URL" , tweetURL )
657
+ }
658
+ func addCommTasksForSingleRelease (
659
+ wd * workflow.Definition , build * BuildReleaseTasks , comm task.CommunicationTasks ,
660
+ kind task.ReleaseKind , versionPublished , securitySummary , securityFixes , names workflow.Value ,
661
+ ) {
662
+ okayToAnnounceAndTweet := wd .Action ("Wait to Announce" , build .ApproveAction , wd .After (versionPublished ))
663
+
664
+ // Announce that a new Go release has been published.
665
+ var announcementURL , tweetURL workflow.Value
666
+ if kind == task .KindCurrentMinor || kind == task .KindPrevMinor {
667
+ sentMail := wd .Task ("mail-announcement" , func (ctx * workflow.TaskContext , v string , sec , names []string ) (task.SentMail , error ) {
668
+ return comm .AnnounceMinorRelease (ctx , task.ReleaseAnnouncement {Version : v , Security : sec , Names : names })
669
+ }, versionPublished , securityFixes , names , wd .After (okayToAnnounceAndTweet ))
670
+ announcementURL = wd .Task ("await-announcement" , comm .AwaitAnnounceMail , sentMail )
671
+ tweetURL = wd .Task ("post-tweet" , func (ctx * workflow.TaskContext , v , sec , ann string ) (string , error ) {
672
+ return comm .TweetMinorRelease (ctx , task.ReleaseTweet {Version : v , Security : sec , Announcement : ann })
673
+ }, versionPublished , securitySummary , announcementURL , wd .After (okayToAnnounceAndTweet ))
674
+ } else {
675
+ // TODO(dmitshur): This can be simplified on this side by deleting older things that use this API,
676
+ // and then merging all the Announce{Kind}Release variants into a single AnnounceRelease entrypoint.
677
+ sentMail := wd .Task ("mail-announcement" , func (ctx * workflow.TaskContext , v string , names []string ) (task.SentMail , error ) {
678
+ switch kind {
679
+ case task .KindMajor :
680
+ return comm .AnnounceMajorRelease (ctx , task.ReleaseAnnouncement {Version : v , Names : names })
681
+ case task .KindRC :
682
+ return comm .AnnounceRCRelease (ctx , task.ReleaseAnnouncement {Version : v , Names : names })
683
+ case task .KindBeta :
684
+ return comm .AnnounceBetaRelease (ctx , task.ReleaseAnnouncement {Version : v , Names : names })
685
+ default :
686
+ return task.SentMail {}, fmt .Errorf ("unknown release kind %v" , kind )
687
+ }
688
+ }, versionPublished , names , wd .After (okayToAnnounceAndTweet ))
689
+ announcementURL = wd .Task ("await-announcement" , comm .AwaitAnnounceMail , sentMail )
690
+ tweetURL = wd .Task ("post-tweet" , func (ctx * workflow.TaskContext , v , ann string ) (string , error ) {
691
+ switch kind {
692
+ case task .KindMajor :
693
+ return comm .TweetMajorRelease (ctx , task.ReleaseTweet {Version : v })
694
+ case task .KindRC :
695
+ return comm .TweetRCRelease (ctx , task.ReleaseTweet {Version : v , Announcement : ann })
696
+ case task .KindBeta :
697
+ return comm .TweetBetaRelease (ctx , task.ReleaseTweet {Version : v , Announcement : ann })
698
+ default :
699
+ return "" , fmt .Errorf ("unknown release kind %v" , kind )
700
+ }
701
+ }, versionPublished , announcementURL , wd .After (okayToAnnounceAndTweet ))
670
702
}
671
703
672
- return wd , nil
704
+ wd .Output ("Announcement URL" , announcementURL )
705
+ wd .Output ("Tweet URL" , tweetURL )
673
706
}
674
707
675
708
func addSingleReleaseWorkflow (
0 commit comments