Skip to content

Commit 9c1815e

Browse files
committed
internal/task: add step to mail announcement in insider release
- Rename mailPrereleaseAnnouncement to mailAnnouncement which handles all kind of vscode-go releases. - Create announcement template for insider release, stable release. For golang/vscode-go#3500 Change-Id: I74ec0a658dcad4c21f7a6d9f7f7c562cf60e012f Reviewed-on: https://go-review.googlesource.com/c/build/+/614718 Reviewed-by: Hyang-Ah Hana Kim <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 0118959 commit 9c1815e

13 files changed

+142
-19
lines changed

internal/task/announce.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,12 @@ func announcementMail(data any) (MailContent, error) {
368368
name = "gopls-announce.md"
369369
case goplsPrereleaseAnnouncement:
370370
name = "gopls-pre-announce.md"
371+
case vscodeGoReleaseAnnouncement:
372+
name = "vscode-go-announce.md"
371373
case vscodeGoPrereleaseAnnouncement:
372374
name = "vscode-go-pre-announce.md"
375+
case vscodeGoInsiderAnnouncement:
376+
name = "vscode-go-insider-announce.md"
373377
default:
374378
return MailContent{}, fmt.Errorf("unknown template data type %T", data)
375379
}
@@ -471,7 +475,17 @@ var announceTmpl = template.Must(template.New("").Funcs(template.FuncMap{
471475
}
472476
return "", fmt.Errorf("internal error: unhandled pre-release Go version %q", v)
473477
},
474-
}).ParseFS(tmplDir, "template/announce-*.md", "template/pre-announce-minor.md", "template/gopls-announce.md", "template/gopls-pre-announce.md", "template/vscode-go-pre-announce.md"))
478+
}).ParseFS(tmplDir,
479+
"template/announce-*.md",
480+
"template/pre-announce-minor.md",
481+
// Gopls release announcements.
482+
"template/gopls-announce.md",
483+
"template/gopls-pre-announce.md",
484+
// VSCode Go release announcements.
485+
"template/vscode-go-pre-announce.md",
486+
"template/vscode-go-insider-announce.md",
487+
"template/vscode-go-announce.md",
488+
))
475489

476490
//go:embed template
477491
var tmplDir embed.FS

internal/task/announce_test.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,15 @@ This is CVE-2022-27536 and https://go.dev/issue/51759.`,
159159
},
160160
wantSubject: "Gopls v0.16.2 is released",
161161
},
162+
{
163+
name: "vscode-go-announce",
164+
in: vscodeGoReleaseAnnouncement{
165+
Version: "v0.44.2",
166+
Branch: "release-v0.44",
167+
Commit: "abc123def456ghi789",
168+
},
169+
wantSubject: "VSCode-Go extension v0.44.2 is released",
170+
},
162171
{
163172
name: "vscode-go-pre-announce",
164173
in: vscodeGoPrereleaseAnnouncement{
@@ -167,7 +176,16 @@ This is CVE-2022-27536 and https://go.dev/issue/51759.`,
167176
Commit: "abc123def456ghi789",
168177
Issue: 12345,
169178
},
170-
wantSubject: "VSCode-Go v0.44.2-rc.1 is released",
179+
wantSubject: "VSCode-Go extension v0.44.2-rc.1 is released",
180+
},
181+
{
182+
name: "vscode-go-insider-announce",
183+
in: vscodeGoInsiderAnnouncement{
184+
Version: "v0.43.2",
185+
Commit: "abc123def456ghi789",
186+
StableVersion: "v0.44.0",
187+
},
188+
wantSubject: "VSCode-Go extension v0.43.2 is released",
171189
},
172190
}
173191
for _, tc := range tests {

internal/task/releasevscodego.go

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ func (r *ReleaseVSCodeGoTasks) NewPrereleaseDefinition() *wf.Definition {
157157
tagged := wf.Action3(wd, "tag release candidate", r.tag, revision, release, prerelease, wf.After(branched))
158158
released := wf.Action3(wd, "create release note", r.createGitHubReleaseDraft, release, prerelease, build, wf.After(tagged))
159159

160-
wf.Action4(wd, "mail announcement", r.mailPrereleaseAnnouncement, release, prerelease, revision, issue, wf.After(released))
160+
wf.Action4(wd, "mail announcement", r.mailAnnouncement, release, prerelease, revision, issue, wf.After(released))
161161
return wd
162162
}
163163

@@ -686,20 +686,48 @@ type vscodeGoPrereleaseAnnouncement struct {
686686
Version string
687687
}
688688

689-
func (r *ReleaseVSCodeGoTasks) mailPrereleaseAnnouncement(ctx *wf.TaskContext, release releaseVersion, prerelease, revision string, issue int) error {
690-
announce := vscodeGoPrereleaseAnnouncement{
691-
Version: release.String() + "-" + prerelease,
692-
Branch: vscodeGoReleaseBranch(release),
693-
Commit: revision,
694-
Issue: issue,
689+
type vscodeGoReleaseAnnouncement struct {
690+
Commit string
691+
Version string
692+
Branch string
693+
}
694+
695+
type vscodeGoInsiderAnnouncement struct {
696+
Commit string
697+
Version string
698+
StableVersion string
699+
}
700+
701+
func (r *ReleaseVSCodeGoTasks) mailAnnouncement(ctx *wf.TaskContext, release releaseVersion, prerelease, revision string, issue int) error {
702+
var announce any
703+
if prerelease != "" {
704+
announce = vscodeGoPrereleaseAnnouncement{
705+
Version: versionString(release, prerelease),
706+
Branch: vscodeGoReleaseBranch(release),
707+
Commit: revision,
708+
Issue: issue,
709+
}
710+
} else if isVSCodeGoInsiderVersion(release, prerelease) {
711+
announce = vscodeGoInsiderAnnouncement{
712+
Version: release.String(),
713+
Commit: revision,
714+
StableVersion: releaseVersion{Major: release.Major, Minor: release.Minor + 1, Patch: 0}.String(),
715+
}
716+
} else {
717+
announce = vscodeGoReleaseAnnouncement{
718+
Version: release.String(),
719+
Commit: revision,
720+
Branch: vscodeGoReleaseBranch(release),
721+
}
695722
}
723+
696724
content, err := announcementMail(announce)
697725
if err != nil {
698726
return err
699727
}
700-
ctx.Printf("pre-announcement subject: %s\n\n", content.Subject)
701-
ctx.Printf("pre-announcement body HTML:\n%s\n", content.BodyHTML)
702-
ctx.Printf("pre-announcement body text:\n%s", content.BodyText)
728+
ctx.Printf("announcement subject: %s\n\n", content.Subject)
729+
ctx.Printf("announcement body HTML:\n%s\n", content.BodyHTML)
730+
ctx.Printf("announcement body text:\n%s", content.BodyText)
703731
return r.SendMail(r.AnnounceMailHeader, content)
704732
}
705733

@@ -734,9 +762,10 @@ func (r *ReleaseVSCodeGoTasks) NewInsiderDefinition() *wf.Definition {
734762

735763
tagged := wf.Action3(wd, "tag the commit", r.tag, revision, release, wf.Const(""), wf.After(build))
736764

737-
_ = wf.Action3(wd, "create release note", r.createGitHubReleaseDraft, release, wf.Const(""), build, wf.After(tagged))
738-
_ = wf.Action2(wd, "publish to vscode marketplace", r.publishPackageExtension, release, build, wf.After(tagged))
765+
released := wf.Action3(wd, "create release note", r.createGitHubReleaseDraft, release, wf.Const(""), build, wf.After(tagged))
766+
published := wf.Action2(wd, "publish to vscode marketplace", r.publishPackageExtension, release, build, wf.After(tagged))
739767

768+
wf.Action4(wd, "mail announcement", r.mailAnnouncement, release, wf.Const(""), revision, wf.Const(0), wf.After(released), wf.After(published))
740769
return wd
741770
}
742771

@@ -849,7 +878,7 @@ func latestVersion(versions []string, filters ...func(releaseVersion, string) bo
849878
}
850879

851880
func (r *ReleaseVSCodeGoTasks) approvePrereleaseVersion(ctx *wf.TaskContext, release releaseVersion, prerelease string) error {
852-
ctx.Printf("The next release candidate will be %s-%s", release, prerelease)
881+
ctx.Printf("The next release candidate will be %s", versionString(release, prerelease))
853882
return r.ApproveAction(ctx)
854883
}
855884

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Subject: VSCode-Go extension {{.Version}} is released
2+
3+
Hello gophers,
4+
5+
We have just released vscode-go {{.Version}}.
6+
7+
View the github release for more information:
8+
https://github.com/golang/vscode-go/releases/tag/{{.Version}}.
9+
10+
Thanks to everyone who contributed to the release.
11+
12+
Cheers,
13+
The Go Tools Team
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Subject: VSCode-Go extension {{.Version}} is released
2+
3+
Hello gophers,
4+
5+
We have just released vscode-go {{.Version}}, an insider version. It is picked from master branch at commit {{.Commit | shortcommit}}.
6+
7+
This is a [pre-release version](https://github.com/golang/vscode-go/?tab=readme-ov-file#pre-release-version) for {{.StableVersion}}. This includes additional, experimental features that are not yet ready for general release. These features are still under development and may be subject to change or removal.
8+
9+
View the github release for more information:
10+
https://github.com/golang/vscode-go/releases/tag/{{.Version}}.
11+
12+
Cheers,
13+
The Go Tools Team

internal/task/template/vscode-go-pre-announce.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Subject: VSCode-Go {{.Version}} is released
1+
Subject: VSCode-Go extension {{.Version}} is released
22

33
Hello gophers,
44

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
* How to test prerelease
1+
* How to test release candidate:
22
* Download the `.vsix` file from this Releases page.
33
* Navigate to the Extensions view in VS Code (`Ctrl+Shift+X`). Click on the "..." in the top-right corner, select "Install from VSIX", and select the `.vsix` file you downloaded. Alternatively, you can run `code --install-extension Go-latest.vsix` or open the Command Palette and run the "Extensions: Install from VSIX..." command.
44
* If prompted, reload VS Code.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<p>Hello gophers,</p>
2+
<p>We have just released vscode-go v0.44.2.</p>
3+
<p>View the github release for more information:<br>
4+
<a href="https://github.com/golang/vscode-go/releases/tag/v0.44.2">https://github.com/golang/vscode-go/releases/tag/v0.44.2</a>.</p>
5+
<p>Thanks to everyone who contributed to the release.</p>
6+
<p>Cheers,<br>
7+
The Go Tools Team</p>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Hello gophers,
2+
3+
We have just released vscode-go v0.44.2.
4+
5+
View the github release for more information:
6+
https://github.com/golang/vscode-go/releases/tag/v0.44.2.
7+
8+
Thanks to everyone who contributed to the release.
9+
10+
Cheers,
11+
The Go Tools Team
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<p>Hello gophers,</p>
2+
<p>We have just released vscode-go v0.43.2, an insider version. It is picked from master branch at commit abc123d.</p>
3+
<p>This is a <a href="https://github.com/golang/vscode-go/?tab=readme-ov-file#pre-release-version">pre-release version</a> for v0.44.0. This includes additional, experimental features that are not yet ready for general release. These features are still under development and may be subject to change or removal.</p>
4+
<p>View the github release for more information:<br>
5+
<a href="https://github.com/golang/vscode-go/releases/tag/v0.43.2">https://github.com/golang/vscode-go/releases/tag/v0.43.2</a>.</p>
6+
<p>Cheers,<br>
7+
The Go Tools Team</p>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Hello gophers,
2+
3+
We have just released vscode-go v0.43.2, an insider version. It is picked from master branch at commit abc123d.
4+
5+
This is a pre-release version <https://github.com/golang/vscode-go/?tab=readme-ov-file#pre-release-version> for v0.44.0. This includes additional, experimental features that are not yet ready for general release. These features are still under development and may be subject to change or removal.
6+
7+
View the github release for more information:
8+
https://github.com/golang/vscode-go/releases/tag/v0.43.2.
9+
10+
Cheers,
11+
The Go Tools Team
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
**Full Changelog**: https://github.com/golang/vscode-go/compare/v0.42.1...v0.44.0-rc.4
22
**Milestone**: https://github.com/golang/vscode-go/issues?q=milestone%3Av0.44.0
33

4-
* How to test prerelease
4+
* How to test release candidate:
55
* Download the `.vsix` file from this Releases page.
66
* Navigate to the Extensions view in VS Code (`Ctrl+Shift+X`). Click on the "..." in the top-right corner, select "Install from VSIX", and select the `.vsix` file you downloaded. Alternatively, you can run `code --install-extension Go-latest.vsix` or open the Command Palette and run the "Extensions: Install from VSIX..." command.
77
* If prompted, reload VS Code.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
**Full Changelog**: https://github.com/golang/vscode-go/compare/v0.42.1...v0.42.2-rc.3
22
**Milestone**: https://github.com/golang/vscode-go/issues?q=milestone%3Av0.42.2
33

4-
* How to test prerelease
4+
* How to test release candidate:
55
* Download the `.vsix` file from this Releases page.
66
* Navigate to the Extensions view in VS Code (`Ctrl+Shift+X`). Click on the "..." in the top-right corner, select "Install from VSIX", and select the `.vsix` file you downloaded. Alternatively, you can run `code --install-extension Go-latest.vsix` or open the Command Palette and run the "Extensions: Install from VSIX..." command.
77
* If prompted, reload VS Code.

0 commit comments

Comments
 (0)