Moved process of generating services-config.json file from platform specific activate scripts to typescript
parent
72e828e704
commit
7252094e2d
|
|
@ -4494,7 +4494,7 @@ class Docker {
|
|||
--volume "${actionFolder}/default-build-script:/UnityBuilderAction:z" \
|
||||
--volume "${actionFolder}/platforms/ubuntu/steps:/steps:z" \
|
||||
--volume "${actionFolder}/platforms/ubuntu/entrypoint.sh:/entrypoint.sh:z" \
|
||||
--volume "${actionFolder}/resources:/resources:z" \
|
||||
--volume "${actionFolder}/unity-config:/usr/share/unity3d/config/:z" \
|
||||
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
|
||||
${sshAgent ? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro' : ''} \
|
||||
${image} \
|
||||
|
|
@ -5350,6 +5350,25 @@ exports["default"] = Output;
|
|||
|
||||
"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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
|
|
@ -5363,11 +5382,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
const fs_1 = __importDefault(__nccwpck_require__(57147));
|
||||
const core = __importStar(__nccwpck_require__(42186));
|
||||
const platform_setup_1 = __nccwpck_require__(2014);
|
||||
const validate_windows_1 = __importDefault(__nccwpck_require__(41563));
|
||||
class PlatformSetup {
|
||||
static setup(buildParameters, actionFolder) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
PlatformSetup.SetupShared(buildParameters, actionFolder);
|
||||
switch (process.platform) {
|
||||
case 'win32':
|
||||
validate_windows_1.default.validate(buildParameters);
|
||||
|
|
@ -5380,6 +5402,17 @@ class PlatformSetup {
|
|||
}
|
||||
});
|
||||
}
|
||||
static SetupShared(buildParameters, actionFolder) {
|
||||
const servicesConfigPath = `${actionFolder}/dist/resources/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%', buildParameters.unityLicensingServer);
|
||||
fs_1.default.writeFileSync(servicesConfigPath, servicesConfig);
|
||||
}
|
||||
}
|
||||
exports["default"] = PlatformSetup;
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -79,10 +79,6 @@ elif [[ -n "$UNITY_LICENSING_SERVER" ]]; then
|
|||
# Custom Unity License Server
|
||||
#
|
||||
echo "Adding licensing server config"
|
||||
pushd /resources
|
||||
cat services-config.json.template | tr -d '\r' | awk "{sub(/%URL%/,\"$UNITY_LICENSING_SERVER\")}1" > services-config.json
|
||||
mkdir -p /usr/share/unity3d/config/
|
||||
mv services-config.json /usr/share/unity3d/config/
|
||||
|
||||
/opt/unity/Editor/Data/Resources/Licensing/Client/Unity.Licensing.Client --acquire-floating > license.txt #is this accessible in a env variable?
|
||||
PARSEDFILE=$(grep -oP '\".*?\"' < license.txt | tr -d '"')
|
||||
|
|
@ -93,7 +89,6 @@ elif [[ -n "$UNITY_LICENSING_SERVER" ]]; then
|
|||
echo "Acquired floating license: \"$FLOATING_LICENSE\" with timeout $FLOATING_LICENSE_TIMEOUT"
|
||||
# Store the exit code from the verify command
|
||||
UNITY_EXIT_CODE=$?
|
||||
popd
|
||||
else
|
||||
#
|
||||
# NO LICENSE ACTIVATION STRATEGY MATCHED
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class Docker {
|
|||
--volume "${actionFolder}/default-build-script:/UnityBuilderAction:z" \
|
||||
--volume "${actionFolder}/platforms/ubuntu/steps:/steps:z" \
|
||||
--volume "${actionFolder}/platforms/ubuntu/entrypoint.sh:/entrypoint.sh:z" \
|
||||
--volume "${actionFolder}/resources:/resources:z" \
|
||||
--volume "${actionFolder}/unity-config:/usr/share/unity3d/config/:z" \
|
||||
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
|
||||
${sshAgent ? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro' : ''} \
|
||||
${image} \
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
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);
|
||||
|
|
@ -16,6 +20,20 @@ class PlatformSetup {
|
|||
// Add other baseOS's here
|
||||
}
|
||||
}
|
||||
|
||||
private static SetupShared(buildParameters: BuildParameters, actionFolder: string) {
|
||||
const servicesConfigPath = `${actionFolder}/dist/resources/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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue