Feature/add support for licensing server (#196)
* First take on adding support for sending in unity licensing server url on linux * Forgot to build dist * Moved services-config parsing to typescript * Need to set licensing server env variable for activate.sh * Forgot unused docker mount directory /resourcespull/201/head v2.1.0
parent
68d1df1d1b
commit
9fe2feb3c9
|
@ -94,7 +94,7 @@ function run() {
|
||||||
try {
|
try {
|
||||||
model_1.Action.checkCompatibility();
|
model_1.Action.checkCompatibility();
|
||||||
const { workspace, actionFolder } = model_1.Action;
|
const { workspace, actionFolder } = model_1.Action;
|
||||||
const { editorVersion, customImage, projectPath, customParameters, testMode, coverageOptions, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, checkName, chownFilesTo, } = model_1.Input.getFromUser();
|
const { editorVersion, customImage, projectPath, customParameters, testMode, coverageOptions, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, checkName, chownFilesTo, unityLicensingServer, } = model_1.Input.getFromUser();
|
||||||
const baseImage = new model_1.ImageTag({ editorVersion, customImage });
|
const baseImage = new model_1.ImageTag({ editorVersion, customImage });
|
||||||
const runnerContext = model_1.Action.runnerContext();
|
const runnerContext = model_1.Action.runnerContext();
|
||||||
try {
|
try {
|
||||||
|
@ -110,7 +110,8 @@ function run() {
|
||||||
sshAgent,
|
sshAgent,
|
||||||
gitPrivateToken,
|
gitPrivateToken,
|
||||||
githubToken,
|
githubToken,
|
||||||
chownFilesTo }, runnerContext));
|
chownFilesTo,
|
||||||
|
unityLicensingServer }, runnerContext));
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
yield model_1.Output.setArtifactsPath(artifactsPath);
|
yield model_1.Output.setArtifactsPath(artifactsPath);
|
||||||
|
@ -208,6 +209,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const fs_1 = __nccwpck_require__(7147);
|
const fs_1 = __nccwpck_require__(7147);
|
||||||
|
const licensing_server_setup_1 = __importDefault(__nccwpck_require__(6089));
|
||||||
const exec_1 = __nccwpck_require__(1514);
|
const exec_1 = __nccwpck_require__(1514);
|
||||||
const path_1 = __importDefault(__nccwpck_require__(1017));
|
const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||||
/**
|
/**
|
||||||
|
@ -237,6 +239,9 @@ const Docker = {
|
||||||
run(image, parameters, silent = false) {
|
run(image, parameters, silent = false) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let runCommand = '';
|
let runCommand = '';
|
||||||
|
if (parameters.unityLicensingServer !== '') {
|
||||||
|
licensing_server_setup_1.default.Setup(parameters.unityLicensingServer, parameters.actionFolder);
|
||||||
|
}
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case 'linux':
|
case 'linux':
|
||||||
runCommand = this.getLinuxCommand(image, parameters);
|
runCommand = this.getLinuxCommand(image, parameters);
|
||||||
|
@ -251,7 +256,7 @@ const Docker = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getLinuxCommand(image, parameters) {
|
getLinuxCommand(image, parameters) {
|
||||||
const { actionFolder, editorVersion, workspace, projectPath, customParameters, testMode, coverageOptions, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, runnerTemporaryPath, chownFilesTo, } = parameters;
|
const { actionFolder, editorVersion, workspace, projectPath, customParameters, testMode, coverageOptions, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, runnerTemporaryPath, chownFilesTo, unityLicensingServer, } = parameters;
|
||||||
const githubHome = path_1.default.join(runnerTemporaryPath, '_github_home');
|
const githubHome = path_1.default.join(runnerTemporaryPath, '_github_home');
|
||||||
if (!(0, fs_1.existsSync)(githubHome))
|
if (!(0, fs_1.existsSync)(githubHome))
|
||||||
(0, fs_1.mkdirSync)(githubHome);
|
(0, fs_1.mkdirSync)(githubHome);
|
||||||
|
@ -269,6 +274,7 @@ const Docker = {
|
||||||
--env UNITY_EMAIL \
|
--env UNITY_EMAIL \
|
||||||
--env UNITY_PASSWORD \
|
--env UNITY_PASSWORD \
|
||||||
--env UNITY_SERIAL \
|
--env UNITY_SERIAL \
|
||||||
|
--env UNITY_LICENSING_SERVER="${unityLicensingServer}" \
|
||||||
--env UNITY_VERSION="${editorVersion}" \
|
--env UNITY_VERSION="${editorVersion}" \
|
||||||
--env PROJECT_PATH="${projectPath}" \
|
--env PROJECT_PATH="${projectPath}" \
|
||||||
--env CUSTOM_PARAMETERS="${customParameters}" \
|
--env CUSTOM_PARAMETERS="${customParameters}" \
|
||||||
|
@ -299,6 +305,7 @@ const Docker = {
|
||||||
--volume "${workspace}:/github/workspace:z" \
|
--volume "${workspace}:/github/workspace:z" \
|
||||||
--volume "${actionFolder}/steps:/steps:z" \
|
--volume "${actionFolder}/steps:/steps:z" \
|
||||||
--volume "${actionFolder}/entrypoint.sh:/entrypoint.sh:z" \
|
--volume "${actionFolder}/entrypoint.sh:/entrypoint.sh:z" \
|
||||||
|
--volume "${actionFolder}/unity-config:/usr/share/unity3d/config/:z" \
|
||||||
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
|
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
|
||||||
${sshAgent ? `--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro` : ''} \
|
${sshAgent ? `--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro` : ''} \
|
||||||
${useHostNetwork ? '--net=host' : ''} \
|
${useHostNetwork ? '--net=host' : ''} \
|
||||||
|
@ -307,7 +314,7 @@ const Docker = {
|
||||||
/bin/bash -c /entrypoint.sh`;
|
/bin/bash -c /entrypoint.sh`;
|
||||||
},
|
},
|
||||||
getWindowsCommand(image, parameters) {
|
getWindowsCommand(image, parameters) {
|
||||||
const { actionFolder, editorVersion, workspace, projectPath, customParameters, testMode, coverageOptions, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, runnerTemporaryPath, chownFilesTo, } = parameters;
|
const { actionFolder, editorVersion, workspace, projectPath, customParameters, testMode, coverageOptions, artifactsPath, useHostNetwork, sshAgent, gitPrivateToken, githubToken, runnerTemporaryPath, chownFilesTo, unityLicensingServer, } = parameters;
|
||||||
const githubHome = path_1.default.join(runnerTemporaryPath, '_github_home');
|
const githubHome = path_1.default.join(runnerTemporaryPath, '_github_home');
|
||||||
if (!(0, fs_1.existsSync)(githubHome))
|
if (!(0, fs_1.existsSync)(githubHome))
|
||||||
(0, fs_1.mkdirSync)(githubHome);
|
(0, fs_1.mkdirSync)(githubHome);
|
||||||
|
@ -325,6 +332,7 @@ const Docker = {
|
||||||
--env UNITY_EMAIL \
|
--env UNITY_EMAIL \
|
||||||
--env UNITY_PASSWORD \
|
--env UNITY_PASSWORD \
|
||||||
--env UNITY_SERIAL \
|
--env UNITY_SERIAL \
|
||||||
|
--env UNITY_LICENSING_SERVER="${unityLicensingServer}" \
|
||||||
--env UNITY_VERSION="${editorVersion}" \
|
--env UNITY_VERSION="${editorVersion}" \
|
||||||
--env PROJECT_PATH="${projectPath}" \
|
--env PROJECT_PATH="${projectPath}" \
|
||||||
--env CUSTOM_PARAMETERS="${customParameters}" \
|
--env CUSTOM_PARAMETERS="${customParameters}" \
|
||||||
|
@ -556,6 +564,7 @@ const Input = {
|
||||||
const unityVersion = (0, core_1.getInput)('unityVersion') || 'auto';
|
const unityVersion = (0, core_1.getInput)('unityVersion') || 'auto';
|
||||||
const customImage = (0, core_1.getInput)('customImage') || '';
|
const customImage = (0, core_1.getInput)('customImage') || '';
|
||||||
const rawProjectPath = (0, core_1.getInput)('projectPath') || '.';
|
const rawProjectPath = (0, core_1.getInput)('projectPath') || '.';
|
||||||
|
const unityLicensingServer = (0, core_1.getInput)('unityLicensingServer') || '';
|
||||||
const customParameters = (0, core_1.getInput)('customParameters') || '';
|
const customParameters = (0, core_1.getInput)('customParameters') || '';
|
||||||
const testMode = ((0, core_1.getInput)('testMode') || 'all').toLowerCase();
|
const testMode = ((0, core_1.getInput)('testMode') || 'all').toLowerCase();
|
||||||
const coverageOptions = (0, core_1.getInput)('coverageOptions') || '';
|
const coverageOptions = (0, core_1.getInput)('coverageOptions') || '';
|
||||||
|
@ -599,12 +608,61 @@ const Input = {
|
||||||
githubToken,
|
githubToken,
|
||||||
checkName,
|
checkName,
|
||||||
chownFilesTo,
|
chownFilesTo,
|
||||||
|
unityLicensingServer,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
exports["default"] = Input;
|
exports["default"] = Input;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 6089:
|
||||||
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
|
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||||
|
class LicensingServerSetup {
|
||||||
|
static Setup(unityLicensingServer, actionFolder) {
|
||||||
|
const servicesConfigPath = `${actionFolder}/unity-config/services-config.json`;
|
||||||
|
const servicesConfigPathTemplate = `${servicesConfigPath}.template`;
|
||||||
|
if (!fs_1.default.existsSync(servicesConfigPathTemplate)) {
|
||||||
|
core.error(`Missing services config ${servicesConfigPathTemplate}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let servicesConfig = fs_1.default.readFileSync(servicesConfigPathTemplate).toString();
|
||||||
|
servicesConfig = servicesConfig.replace('%URL%', unityLicensingServer);
|
||||||
|
fs_1.default.writeFileSync(servicesConfigPath, servicesConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports["default"] = LicensingServerSetup;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 5487:
|
/***/ 5487:
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -77,7 +77,21 @@ elif [[ -n "$UNITY_SERIAL" && -n "$UNITY_EMAIL" && -n "$UNITY_PASSWORD" ]]; then
|
||||||
|
|
||||||
# Store the exit code from the verify command
|
# Store the exit code from the verify command
|
||||||
UNITY_EXIT_CODE=$?
|
UNITY_EXIT_CODE=$?
|
||||||
|
elif [[ -n "$UNITY_LICENSING_SERVER" ]]; then
|
||||||
|
#
|
||||||
|
# Custom Unity License Server
|
||||||
|
#
|
||||||
|
echo "Adding licensing server config"
|
||||||
|
|
||||||
|
/opt/unity/Editor/Data/Resources/Licensing/Client/Unity.Licensing.Client --acquire-floating > license.txt #is this accessible in a env variable?
|
||||||
|
UNITY_EXIT_CODE=$?
|
||||||
|
PARSEDFILE=$(grep -oP '\".*?\"' < license.txt | tr -d '"')
|
||||||
|
export FLOATING_LICENSE
|
||||||
|
FLOATING_LICENSE=$(sed -n 2p <<< "$PARSEDFILE")
|
||||||
|
FLOATING_LICENSE_TIMEOUT=$(sed -n 4p <<< "$PARSEDFILE")
|
||||||
|
|
||||||
|
echo "Acquired floating license: \"$FLOATING_LICENSE\" with timeout $FLOATING_LICENSE_TIMEOUT"
|
||||||
|
# Store the exit code from the verify command
|
||||||
else
|
else
|
||||||
#
|
#
|
||||||
# NO LICENSE ACTIVATION STRATEGY MATCHED
|
# NO LICENSE ACTIVATION STRATEGY MATCHED
|
||||||
|
|
|
@ -4,7 +4,13 @@
|
||||||
echo "Changing to \"$ACTIVATE_LICENSE_PATH\" directory."
|
echo "Changing to \"$ACTIVATE_LICENSE_PATH\" directory."
|
||||||
pushd "$ACTIVATE_LICENSE_PATH"
|
pushd "$ACTIVATE_LICENSE_PATH"
|
||||||
|
|
||||||
if [[ -n "$UNITY_SERIAL" ]]; then
|
if [[ -n "$UNITY_LICENSING_SERVER" ]]; then #
|
||||||
|
#
|
||||||
|
# Return any floating license used.
|
||||||
|
#
|
||||||
|
echo "Returning floating license: \"$FLOATING_LICENSE\""
|
||||||
|
/opt/unity/Editor/Data/Resources/Licensing/Client/Unity.Licensing.Client --return-floating "$FLOATING_LICENSE"
|
||||||
|
elif [[ -n "$UNITY_SERIAL" ]]; then
|
||||||
#
|
#
|
||||||
# PROFESSIONAL (SERIAL) LICENSE MODE
|
# PROFESSIONAL (SERIAL) LICENSE MODE
|
||||||
#
|
#
|
||||||
|
@ -17,6 +23,5 @@ if [[ -n "$UNITY_SERIAL" ]]; then
|
||||||
-quit \
|
-quit \
|
||||||
-returnlicense
|
-returnlicense
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Return to previous working directory
|
# Return to previous working directory
|
||||||
popd
|
popd
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"licensingServiceBaseUrl": "%URL%",
|
||||||
|
"enableEntitlementLicensing": true,
|
||||||
|
"enableFloatingApi": true,
|
||||||
|
"clientConnectTimeoutSec": 5,
|
||||||
|
"clientHandshakeTimeoutSec": 10
|
||||||
|
}
|
|
@ -20,6 +20,7 @@ export async function run() {
|
||||||
githubToken,
|
githubToken,
|
||||||
checkName,
|
checkName,
|
||||||
chownFilesTo,
|
chownFilesTo,
|
||||||
|
unityLicensingServer,
|
||||||
} = Input.getFromUser();
|
} = Input.getFromUser();
|
||||||
const baseImage = new ImageTag({ editorVersion, customImage });
|
const baseImage = new ImageTag({ editorVersion, customImage });
|
||||||
const runnerContext = Action.runnerContext();
|
const runnerContext = Action.runnerContext();
|
||||||
|
@ -39,6 +40,7 @@ export async function run() {
|
||||||
gitPrivateToken,
|
gitPrivateToken,
|
||||||
githubToken,
|
githubToken,
|
||||||
chownFilesTo,
|
chownFilesTo,
|
||||||
|
unityLicensingServer,
|
||||||
...runnerContext,
|
...runnerContext,
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { existsSync, mkdirSync, readFileSync, rmSync } from 'fs';
|
import { existsSync, mkdirSync, readFileSync, rmSync } from 'fs';
|
||||||
|
import LicensingServerSetup from './licensing-server-setup';
|
||||||
import type { RunnerContext } from './action';
|
import type { RunnerContext } from './action';
|
||||||
import { exec } from '@actions/exec';
|
import { exec } from '@actions/exec';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
@ -30,6 +31,11 @@ const Docker = {
|
||||||
|
|
||||||
async run(image, parameters, silent = false) {
|
async run(image, parameters, silent = false) {
|
||||||
let runCommand = '';
|
let runCommand = '';
|
||||||
|
|
||||||
|
if (parameters.unityLicensingServer !== '') {
|
||||||
|
LicensingServerSetup.Setup(parameters.unityLicensingServer, parameters.actionFolder);
|
||||||
|
}
|
||||||
|
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case 'linux':
|
case 'linux':
|
||||||
runCommand = this.getLinuxCommand(image, parameters);
|
runCommand = this.getLinuxCommand(image, parameters);
|
||||||
|
@ -60,6 +66,7 @@ const Docker = {
|
||||||
githubToken,
|
githubToken,
|
||||||
runnerTemporaryPath,
|
runnerTemporaryPath,
|
||||||
chownFilesTo,
|
chownFilesTo,
|
||||||
|
unityLicensingServer,
|
||||||
} = parameters;
|
} = parameters;
|
||||||
|
|
||||||
const githubHome = path.join(runnerTemporaryPath, '_github_home');
|
const githubHome = path.join(runnerTemporaryPath, '_github_home');
|
||||||
|
@ -80,6 +87,7 @@ const Docker = {
|
||||||
--env UNITY_EMAIL \
|
--env UNITY_EMAIL \
|
||||||
--env UNITY_PASSWORD \
|
--env UNITY_PASSWORD \
|
||||||
--env UNITY_SERIAL \
|
--env UNITY_SERIAL \
|
||||||
|
--env UNITY_LICENSING_SERVER="${unityLicensingServer}" \
|
||||||
--env UNITY_VERSION="${editorVersion}" \
|
--env UNITY_VERSION="${editorVersion}" \
|
||||||
--env PROJECT_PATH="${projectPath}" \
|
--env PROJECT_PATH="${projectPath}" \
|
||||||
--env CUSTOM_PARAMETERS="${customParameters}" \
|
--env CUSTOM_PARAMETERS="${customParameters}" \
|
||||||
|
@ -110,6 +118,7 @@ const Docker = {
|
||||||
--volume "${workspace}:/github/workspace:z" \
|
--volume "${workspace}:/github/workspace:z" \
|
||||||
--volume "${actionFolder}/steps:/steps:z" \
|
--volume "${actionFolder}/steps:/steps:z" \
|
||||||
--volume "${actionFolder}/entrypoint.sh:/entrypoint.sh:z" \
|
--volume "${actionFolder}/entrypoint.sh:/entrypoint.sh:z" \
|
||||||
|
--volume "${actionFolder}/unity-config:/usr/share/unity3d/config/:z" \
|
||||||
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
|
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
|
||||||
${
|
${
|
||||||
sshAgent ? `--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro` : ''
|
sshAgent ? `--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro` : ''
|
||||||
|
@ -136,6 +145,7 @@ const Docker = {
|
||||||
githubToken,
|
githubToken,
|
||||||
runnerTemporaryPath,
|
runnerTemporaryPath,
|
||||||
chownFilesTo,
|
chownFilesTo,
|
||||||
|
unityLicensingServer,
|
||||||
} = parameters;
|
} = parameters;
|
||||||
|
|
||||||
const githubHome = path.join(runnerTemporaryPath, '_github_home');
|
const githubHome = path.join(runnerTemporaryPath, '_github_home');
|
||||||
|
@ -156,6 +166,7 @@ const Docker = {
|
||||||
--env UNITY_EMAIL \
|
--env UNITY_EMAIL \
|
||||||
--env UNITY_PASSWORD \
|
--env UNITY_PASSWORD \
|
||||||
--env UNITY_SERIAL \
|
--env UNITY_SERIAL \
|
||||||
|
--env UNITY_LICENSING_SERVER="${unityLicensingServer}" \
|
||||||
--env UNITY_VERSION="${editorVersion}" \
|
--env UNITY_VERSION="${editorVersion}" \
|
||||||
--env PROJECT_PATH="${projectPath}" \
|
--env PROJECT_PATH="${projectPath}" \
|
||||||
--env CUSTOM_PARAMETERS="${customParameters}" \
|
--env CUSTOM_PARAMETERS="${customParameters}" \
|
||||||
|
|
|
@ -17,6 +17,7 @@ const Input = {
|
||||||
const unityVersion = getInput('unityVersion') || 'auto';
|
const unityVersion = getInput('unityVersion') || 'auto';
|
||||||
const customImage = getInput('customImage') || '';
|
const customImage = getInput('customImage') || '';
|
||||||
const rawProjectPath = getInput('projectPath') || '.';
|
const rawProjectPath = getInput('projectPath') || '.';
|
||||||
|
const unityLicensingServer = getInput('unityLicensingServer') || '';
|
||||||
const customParameters = getInput('customParameters') || '';
|
const customParameters = getInput('customParameters') || '';
|
||||||
const testMode = (getInput('testMode') || 'all').toLowerCase();
|
const testMode = (getInput('testMode') || 'all').toLowerCase();
|
||||||
const coverageOptions = getInput('coverageOptions') || '';
|
const coverageOptions = getInput('coverageOptions') || '';
|
||||||
|
@ -67,6 +68,7 @@ const Input = {
|
||||||
githubToken,
|
githubToken,
|
||||||
checkName,
|
checkName,
|
||||||
chownFilesTo,
|
chownFilesTo,
|
||||||
|
unityLicensingServer,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
import fs from 'fs';
|
||||||
|
|
||||||
|
class LicensingServerSetup {
|
||||||
|
public static Setup(unityLicensingServer, actionFolder: string) {
|
||||||
|
const servicesConfigPath = `${actionFolder}/unity-config/services-config.json`;
|
||||||
|
const servicesConfigPathTemplate = `${servicesConfigPath}.template`;
|
||||||
|
if (!fs.existsSync(servicesConfigPathTemplate)) {
|
||||||
|
core.error(`Missing services config ${servicesConfigPathTemplate}`);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let servicesConfig = fs.readFileSync(servicesConfigPathTemplate).toString();
|
||||||
|
servicesConfig = servicesConfig.replace('%URL%', unityLicensingServer);
|
||||||
|
fs.writeFileSync(servicesConfigPath, servicesConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default LicensingServerSetup;
|
Loading…
Reference in New Issue