buildWeb function
Future<void>
buildWeb(
- ExecContext context, {
- required String gh,
- required String appName,
- required int defaultIncrementNumber,
Gibhut Actions build for Web.
Web用のGibhut Actionsのビルド。
Implementation
Future<void> buildWeb(
ExecContext context, {
required String gh,
required String appName,
required int defaultIncrementNumber,
}) async {
final github = context.yaml.getAsMap("github");
final action = github.getAsMap("action");
final web = action.getAsMap("web");
final renderer = web.get("renderer", "canvaskit");
final secretGithub = context.secrets.getAsMap("github");
final slack = secretGithub.getAsMap("slack");
final slackIncomingWebhookUrl = slack.get("incoming_webhook_url", "");
final gitDir = await findGitDirectory(Directory.current);
final webCode = GithubActionsWebCliCode(
workingDirectory: gitDir,
defaultIncrementNumber: defaultIncrementNumber,
renderer: renderer,
);
var hostingYamlFile =
File("${webCode.directory}/firebase-hosting-pull-request.yml");
if (!hostingYamlFile.existsSync()) {
hostingYamlFile = File(
".dart_tool/katana/firebase-hosting-pull-request-${appName.toLowerCase()}.yml");
}
if (!hostingYamlFile.existsSync() &&
File("${webCode.directory}/build_web_${appName.toLowerCase()}.yaml")
.existsSync()) {
return;
}
final yaml = hostingYamlFile.existsSync()
? loadYaml(await hostingYamlFile.readAsString())
: {};
await webCode.generateFile(
"build_web_${appName.toLowerCase()}.yaml",
filter: (source) => webCode._additionalSlackFilter(
webCode._additionalFilter(yaml, source),
slackIncomingWebhookUrl,
),
);
if (hostingYamlFile.existsSync() &&
!File(".dart_tool/katana/firebase-hosting-pull-request-${appName.toLowerCase()}.yml")
.existsSync()) {
if (!Directory(".dart_tool/katana").existsSync()) {
Directory(".dart_tool/katana").createSync(recursive: true);
}
await hostingYamlFile.rename(
".dart_tool/katana/firebase-hosting-pull-request-${appName.toLowerCase()}.yml");
}
}