* Initial support for adding a UNITY_LICENSING_SERVER parameter to build parameters * Test to figure out what the working directory is of current bash script * Outputting current directory and using $ACTION_FOLDER * Add resources folder to mounted docker volumes. Used by activation script to copy over template file for unity licensing server * use awk instead of sed due to http characters breaking syntax * mkdir for unity config * Add -p flag to mkdir so parents are also created if missing * Initial work on returning floating license when using licensing server * Checking licensing server first for now, since serial is always set * Parse and save acquired floating license for use for returning after build * Clean up duplicate commands in activate.sh * Fixed running string as command, use it as input instead * Fixed cloud runner tests failing when using a ssh remote. * Clean up of test files and unnecessary logging * Moved process of generating services-config.json file from platform specific activate scripts to typescript * Fixed path
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import fs from 'fs';
|
|
import * as core from '@actions/core';
|
|
import { BuildParameters } from '.';
|
|
import { SetupMac, SetupWindows } from './platform-setup/';
|
|
import ValidateWindows from './platform-validation/validate-windows';
|
|
|
|
class PlatformSetup {
|
|
static async setup(buildParameters: BuildParameters, actionFolder: string) {
|
|
PlatformSetup.SetupShared(buildParameters, actionFolder);
|
|
|
|
switch (process.platform) {
|
|
case 'win32':
|
|
ValidateWindows.validate(buildParameters);
|
|
SetupWindows.setup(buildParameters);
|
|
break;
|
|
case 'darwin':
|
|
await SetupMac.setup(buildParameters, actionFolder);
|
|
break;
|
|
|
|
// Add other baseOS's here
|
|
}
|
|
}
|
|
|
|
private static SetupShared(buildParameters: BuildParameters, 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%', buildParameters.unityLicensingServer);
|
|
fs.writeFileSync(servicesConfigPath, servicesConfig);
|
|
}
|
|
}
|
|
|
|
export default PlatformSetup;
|