Skip to content

Commit a3cf020

Browse files
author
Sebastian Hahn
committed
Add mysql installation path
1 parent 738f744 commit a3cf020

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const os = require('os');
44
const path = require('path');
55
const process = require('process');
66
const spawnSync = require('child_process').spawnSync;
7+
const core = require('@actions/core')
78

89
function run(command) {
910
console.log(command);
@@ -43,6 +44,7 @@ const defaultVersion = (image == 'ubuntu16' || image == 'ubuntu18') ? '5.7' : '8
4344
const mysqlVersion = parseFloat(process.env['INPUT_MYSQL-VERSION'] || defaultVersion).toFixed(1);
4445
const username = process.env['INPUT_USERNAME'] || "";
4546
const password = process.env['INPUT_PASSWORD'] || "";
47+
const mysqlInstallDirectory = process.env['INPUT_INSTALL-DIRECTORY'] || "";
4648

4749
// TODO make OS-specific
4850
if (!['8.0', '5.7', '5.6'].includes(mysqlVersion)) {
@@ -84,15 +86,14 @@ function installWindwos() {
8486
'5.7': '5.7.32',
8587
'5.6': '5.6.50'
8688
};
87-
installDir = "C:\\Program Files\\MySQL";
88-
bin = `C:\\Program Files\\MySQL\\MySQL Server ${mysqlVersion}\\bin`;
89-
if (! fs.existsSync(installDir)) {
89+
bin = `${mysqlInstallDirectory}\\bin`;
90+
if (! fs.existsSync(mysqlInstallDirectory)) {
9091
const fullVersion = versionMap[mysqlVersion];
9192
useTmpDir();
9293
run(`curl -Ls -o mysql.zip https://dev.mysql.com/get/Downloads/MySQL-${mysqlVersion}/mysql-${fullVersion}-winx64.zip`)
9394
run(`unzip -q mysql.zip`);
94-
fs.mkdirSync(installDir);
95-
fs.renameSync(`mysql-${fullVersion}-winx64`, `C:\\Program Files\\MySQL\\MySQL Server ${mysqlVersion}`);
95+
fs.mkdirSync(mysqlInstallDirectory);
96+
fs.renameSync(`mysql-${fullVersion}-winx64`, mysqlInstallDirectory);
9697

9798
// start
9899
if (mysqlVersion != '5.6') {

0 commit comments

Comments
 (0)