-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathindex.ts
More file actions
37 lines (29 loc) · 1.31 KB
/
index.ts
File metadata and controls
37 lines (29 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import { buildInstallArgs, buildMysqlPrepArgs, getDatabaseService, Services } from './build-command';
export async function run(): Promise<void> {
try {
const servicesInput = core.getInput('services');
const path = core.getInput('path') || '.';
const extraArgs = core.getInput('extra_args').trim();
let services: Services | null = null;
if (servicesInput && servicesInput !== 'null') {
services = JSON.parse(servicesInput) as Services;
}
// setup:install creates MySQL triggers, which requires log_bin_trust_function_creators=1
// when binary logging is enabled. The same SQL works against MariaDB.
const database = services ? getDatabaseService(services) : undefined;
if (database) {
await exec.exec('mysql', buildMysqlPrepArgs(database));
}
const args = buildInstallArgs(services);
if (extraArgs) {
args.push(...extraArgs.split(/\s+/));
}
core.setOutput('command', `php bin/magento setup:install ${args.join(' ')}`);
await exec.exec('php', ['bin/magento', 'setup:install', ...args], { cwd: path });
} catch (error) {
core.setFailed((error as Error).message);
}
}
run();