Skip to content

Commit 98b6abe

Browse files
committed
github - use GHA workflow commands to group logs
1 parent d1760c4 commit 98b6abe

4 files changed

Lines changed: 32 additions & 29 deletions

File tree

package/src/bld.ts

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -61,57 +61,47 @@ function getCommands() {
6161
// deno-lint-ignore no-explicit-any
6262
const commands: Command<any>[] = [];
6363
commands.push(
64-
packageCommand(configure)
65-
.name("configure")
64+
packageCommand(configure, "configure")
6665
.description(
6766
"Configures this machine for running developer version of Quarto",
6867
),
6968
);
7069
commands.push(
71-
packageCommand(updateHtmlDependencies)
72-
.name("update-html-dependencies")
70+
packageCommand(updateHtmlDependencies, "update-html-dependencies")
7371
.description(
7472
"Updates Bootstrap, themes, and JS/CSS dependencies based upon the version in configuration",
7573
),
7674
);
7775
commands.push(
78-
packageCommand(archiveBinaryDependencies)
79-
.name("archive-bin-deps")
76+
packageCommand(archiveBinaryDependencies, "archive-bin-deps")
8077
.description("Downloads and archives our binary dependencies."),
8178
);
8279
commands.push(
83-
packageCommand(checkBinaryDependencies)
84-
.name("check-bin-deps")
80+
packageCommand(checkBinaryDependencies, "check-bin-deps")
8581
.description("Checks the paths and URLs of our binary dependencies."),
8682
);
8783
commands.push(
88-
packageCommand(prepareDist)
89-
.name("prepare-dist")
84+
packageCommand(prepareDist, "prepare-dist")
9085
.description("Prepares the distribution directory for packaging."),
9186
);
9287
commands.push(
93-
packageCommand(validateBundle)
94-
.name("validate-bundle")
88+
packageCommand(validateBundle, "validate-bundle")
9589
.description("Validate a JS bundle built using prepare-dist")
9690
);
9791
commands.push(
98-
packageCommand(makeInstallerMac)
99-
.name("make-installer-mac")
92+
packageCommand(makeInstallerMac, "make-installer-mac")
10093
.description("Builds Mac OS installer"),
10194
);
10295
commands.push(
103-
packageCommand(makeInstallerDeb)
104-
.name("make-installer-deb")
96+
packageCommand(makeInstallerDeb, "make-installer-deb")
10597
.description("Builds Linux deb installer"),
10698
);
10799
commands.push(
108-
packageCommand(makeInstallerWindows)
109-
.name("make-installer-win")
100+
packageCommand(makeInstallerWindows, "make-installer-win")
110101
.description("Builds Windows installer"),
111102
);
112103
commands.push(
113-
packageCommand(makeInstallerExternal)
114-
.name("make-installer-dir")
104+
packageCommand(makeInstallerExternal, "make-installer-dir")
115105
.description("Copies Quarto-only files, omitting dependencies, to specified location (for use in third party packaging)"),
116106
);
117107
commands.push(

package/src/cmd/pkg-cmd.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import { Command } from "cliffy/command/mod.ts";
88
import { join } from "../../../src/deno_ral/path.ts";
99

10+
import { group } from "../../../src/tools/github.ts";
11+
1012
import { printConfiguration } from "../common/config.ts";
1113

1214
import {
@@ -19,7 +21,7 @@ import {
1921
export const kLogLevel = "logLevel";
2022
export const kVersion = "setVersion";
2123

22-
export function packageCommand(run: (config: Configuration) => Promise<void>) {
24+
export function packageCommand(run: (config: Configuration) => Promise<void>, commandName: string) {
2325
return new Command().option(
2426
"-sv, --set-version [version:string]",
2527
"Version to set when preparing this distribution",
@@ -51,7 +53,9 @@ export function packageCommand(run: (config: Configuration) => Promise<void>) {
5153
// Print the configuration
5254
printConfiguration(config);
5355

54-
// Run the command
55-
await run(config);
56-
});
56+
await group(commandName, async () => {
57+
// Run the command
58+
await run(config);
59+
});
60+
}).name(commandName);
5761
}

src/import_map.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"encoding/": "jsr:/@std/encoding@1.0.9/",
77
"fmt/": "jsr:/@std/fmt@1.0.6/",
88
"fs/": "jsr:/@std/fs@1.0.16/",
9+
"github_actions/core": "npm:@actions/core@1.11.1",
910
"http/": "jsr:/@std/http@1.0.14/",
1011
"path": "jsr:@std/path@1.0.8",
1112
"path/posix": "jsr:@std/path@1.0.8/posix",

src/tools/github.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
2-
* github.ts
3-
*
4-
* Copyright (C) 2020-2022 Posit Software, PBC
5-
*
6-
*/
2+
* github.ts
3+
*
4+
* Copyright (C) 2020-2022 Posit Software, PBC
5+
*/
76

87
import { GitHubRelease } from "./types.ts";
8+
import * as core from "github_actions/core";
99

1010
// deno-lint-ignore-file camelcase
1111

@@ -26,3 +26,11 @@ export async function getLatestRelease(repo: string): Promise<GitHubRelease> {
2626
return response.json();
2727
}
2828
}
29+
30+
export async function group<T>(title: string, fn: () => Promise<T>) {
31+
Deno.env.get("CI");
32+
if (!Deno.env.get("CI")) {
33+
return fn();
34+
}
35+
return core.group(title, fn);
36+
}

0 commit comments

Comments
 (0)