Skip to content

Commit 9ca3b00

Browse files
committed
feat(dist): automatically run most shell commands
Instead of forcing the user to copy-paste shell commands, run the commands on the user's behalf.
1 parent 58585e1 commit 9ca3b00

File tree

1 file changed

+38
-21
lines changed

1 file changed

+38
-21
lines changed

dist/release.go

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,12 @@ var Steps []Step = []Step{
170170
if ReleaseCommitHash == "" {
171171
Stopf("missing -ReleaseCommitHash\n")
172172
}
173-
fmt.Printf("Download the build artifacts from the artifact server:\n")
174-
fmt.Printf("$ rsync -av github-ci@c.quick-lint-js.com:/var/www/c.quick-lint-js.com/builds/%s/ builds/\n", ReleaseCommitHash)
175-
WaitForDone()
173+
RunCommandOrStop(
174+
"rsync",
175+
"-av",
176+
fmt.Sprintf("github-ci@c.quick-lint-js.com:/var/www/c.quick-lint-js.com/builds/%s/", ReleaseCommitHash),
177+
"builds/",
178+
)
176179
},
177180
},
178181

@@ -186,9 +189,15 @@ var Steps []Step = []Step{
186189
Step{
187190
Title: "Sign the build artifacts",
188191
Run: func() {
189-
fmt.Printf("Sign the build artifacts:\n")
190-
fmt.Printf("$ go run dist/sign-release.go dist/deep-hasher.go dist/appx.go -RelicConfig=dist/certificates/relic-config.yaml builds/ signed-builds/\n")
191-
WaitForDone()
192+
RunCommandOrStop(
193+
"go", "run",
194+
"dist/sign-release.go",
195+
"dist/deep-hasher.go",
196+
"dist/appx.go",
197+
"-RelicConfig=dist/certificates/relic-config.yaml",
198+
"builds/",
199+
"signed-builds/",
200+
)
192201
},
193202
},
194203

@@ -220,27 +229,34 @@ var Steps []Step = []Step{
220229
Step{
221230
Title: "Upload the signed build artifacts",
222231
Run: func() {
223-
fmt.Printf("Upload the signed build artifacts to the artifact server:\n")
224-
fmt.Printf("$ rsync -av signed-builds/ github-ci@c.quick-lint-js.com:/var/www/c.quick-lint-js.com/releases/%s/\n", ReleaseVersion)
225-
WaitForDone()
232+
RunCommandOrStop(
233+
"rsync",
234+
"-av",
235+
"signed-builds/",
236+
fmt.Sprintf("github-ci@c.quick-lint-js.com:/var/www/c.quick-lint-js.com/releases/%s/", ReleaseVersion),
237+
)
226238
},
227239
},
228240

229241
Step{
230242
Title: "Update `latest` symlink",
231243
Run: func() {
232-
fmt.Printf("Update the `latest` symlink on the artifact server:\n")
233-
fmt.Printf("$ ssh github-ci@c.quick-lint-js.com \"ln --force --no-dereference --symbolic %s /var/www/c.quick-lint-js.com/releases/latest\"\n", ReleaseVersion)
234-
WaitForDone()
244+
RunCommandOrStop(
245+
"ssh",
246+
"github-ci@c.quick-lint-js.com",
247+
fmt.Sprintf("ln --force --no-dereference --symbolic %s /var/www/c.quick-lint-js.com/releases/latest", ReleaseVersion),
248+
)
235249
},
236250
},
237251

238252
Step{
239253
Title: "Publish the Visual Studio Code extension to the Marketplace",
240254
Run: func() {
241-
fmt.Printf("With the `vscode/quick-lint-js-*.vsix` artifact:\n")
242-
fmt.Printf("$ npx vsce publish --packagePath signed-builds/vscode/quick-lint-js-%s.vsix\n", ReleaseVersion)
243-
WaitForDone()
255+
RunCommandOrStop(
256+
"npx", "vsce",
257+
"publish",
258+
"--packagePath", fmt.Sprintf("signed-builds/vscode/quick-lint-js-%s.vsix", ReleaseVersion),
259+
)
244260
},
245261
},
246262

@@ -256,17 +272,18 @@ var Steps []Step = []Step{
256272
Step{
257273
Title: "Publish to npm",
258274
Run: func() {
259-
fmt.Printf("With the `npm/quick-lint-js-*.tgz` artifact:\n")
260-
fmt.Printf("$ npm publish signed-builds/npm/quick-lint-js-%s.tgz\n", ReleaseVersion)
261-
WaitForDone()
275+
RunCommandOrStop(
276+
"npm",
277+
"publish",
278+
fmt.Sprintf("signed-builds/npm/quick-lint-js-%s.tgz", ReleaseVersion),
279+
)
262280
},
263281
},
264282

265283
Step{
266284
Title: "Publish Debian packages",
267285
Run: func() {
268-
fmt.Printf("Run the `dist/debian/sync-releases-to-apt` script.\n")
269-
WaitForDone()
286+
RunCommandOrStop("./dist/debian/sync-releases-to-apt")
270287
},
271288
},
272289

@@ -276,7 +293,7 @@ var Steps []Step = []Step{
276293
if ReleaseCommitHash == "" {
277294
Stopf("missing -ReleaseCommitHash\n")
278295
}
279-
fmt.Printf("Publish the website: Run `./website/tools/deploy.sh %s`.\n", ReleaseCommitHash)
296+
RunCommandOrStop("./website/tools/deploy.sh", ReleaseCommitHash)
280297
WaitForDone()
281298
},
282299
},

0 commit comments

Comments
 (0)