Merge remote-tracking branch 'origin/main' into cloud-runner-develop
# Conflicts: # .github/workflows/cloud-runner-async-checks.yml # dist/index.js.mappull/479/head
commit
5d512a0a59
|
|
@ -192,6 +192,8 @@ outputs:
|
|||
description: 'The Persistent Volume (PV) where the build artifacts have been stored by Kubernetes'
|
||||
buildVersion:
|
||||
description: 'The generated version used for the Unity build'
|
||||
androidVersionCode:
|
||||
description: 'The generated versionCode used for the Android Unity build'
|
||||
branding:
|
||||
icon: 'box'
|
||||
color: 'gray-dark'
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ function runMain() {
|
|||
}
|
||||
// Set output
|
||||
yield model_1.Output.setBuildVersion(buildParameters.buildVersion);
|
||||
yield model_1.Output.setAndroidVersionCode(buildParameters.androidVersionCode);
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
|
|
@ -6288,7 +6289,7 @@ class Docker {
|
|||
static getWindowsCommand(image, parameters) {
|
||||
const { workspace, actionFolder, unitySerial, gitPrivateToken } = parameters;
|
||||
return `docker run \
|
||||
--workdir /github/workspace \
|
||||
--workdir c:/github/workspace \
|
||||
--rm \
|
||||
${image_environment_factory_1.default.getEnvVarString(parameters)} \
|
||||
--env UNITY_SERIAL="${unitySerial}" \
|
||||
|
|
@ -6597,7 +6598,6 @@ class ImageEnvironmentFactory {
|
|||
{ name: 'GITHUB_HEAD_REF', value: process.env.GITHUB_HEAD_REF },
|
||||
{ name: 'GITHUB_BASE_REF', value: process.env.GITHUB_BASE_REF },
|
||||
{ name: 'GITHUB_EVENT_NAME', value: process.env.GITHUB_EVENT_NAME },
|
||||
{ name: 'GITHUB_WORKSPACE', value: '/github/workspace' },
|
||||
{ name: 'GITHUB_ACTION', value: process.env.GITHUB_ACTION },
|
||||
{ name: 'GITHUB_EVENT_PATH', value: process.env.GITHUB_EVENT_PATH },
|
||||
{ name: 'RUNNER_OS', value: process.env.RUNNER_OS },
|
||||
|
|
@ -7257,6 +7257,11 @@ class Output {
|
|||
yield core.setOutput('buildVersion', buildVersion);
|
||||
});
|
||||
}
|
||||
static setAndroidVersionCode(androidVersionCode) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield core.setOutput('androidVersionCode', androidVersionCode);
|
||||
});
|
||||
}
|
||||
}
|
||||
exports["default"] = Output;
|
||||
|
||||
|
|
@ -7330,6 +7335,7 @@ class PlatformSetup {
|
|||
let servicesConfig = fs_1.default.readFileSync(servicesConfigPathTemplate).toString();
|
||||
servicesConfig = servicesConfig.replace('%URL%', buildParameters.unityLicensingServer);
|
||||
fs_1.default.writeFileSync(servicesConfigPath, servicesConfig);
|
||||
platform_setup_1.SetupAndroid.setup(buildParameters);
|
||||
}
|
||||
}
|
||||
exports["default"] = PlatformSetup;
|
||||
|
|
@ -7346,11 +7352,53 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.SetupMac = exports.SetupWindows = void 0;
|
||||
exports.SetupAndroid = exports.SetupMac = exports.SetupWindows = void 0;
|
||||
const setup_windows_1 = __importDefault(__nccwpck_require__(37449));
|
||||
exports.SetupWindows = setup_windows_1.default;
|
||||
const setup_mac_1 = __importDefault(__nccwpck_require__(22466));
|
||||
exports.SetupMac = setup_mac_1.default;
|
||||
const setup_android_1 = __importDefault(__nccwpck_require__(45142));
|
||||
exports.SetupAndroid = setup_android_1.default;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 45142:
|
||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
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) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
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 path_1 = __importDefault(__nccwpck_require__(71017));
|
||||
class SetupAndroid {
|
||||
static setup(buildParameters) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { targetPlatform, androidKeystoreBase64, androidKeystoreName, projectPath } = buildParameters;
|
||||
if (targetPlatform === 'Android' && androidKeystoreBase64 !== '' && androidKeystoreName !== '') {
|
||||
SetupAndroid.setupAndroidRun(androidKeystoreBase64, androidKeystoreName, projectPath);
|
||||
}
|
||||
});
|
||||
}
|
||||
static setupAndroidRun(androidKeystoreBase64, androidKeystoreName, projectPath) {
|
||||
const decodedKeystore = Buffer.from(androidKeystoreBase64, 'base64').toString('binary');
|
||||
const githubWorkspace = process.env.GITHUB_WORKSPACE || '';
|
||||
fs_1.default.writeFileSync(path_1.default.join(githubWorkspace, projectPath, androidKeystoreName), decodedKeystore, 'binary');
|
||||
}
|
||||
}
|
||||
exports["default"] = SetupAndroid;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
|
@ -7404,11 +7452,21 @@ class SetupMac {
|
|||
static installUnity(buildParameters, silent = false) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const unityChangeset = yield unity_changeset_1.getUnityChangeset(buildParameters.editorVersion);
|
||||
const command = `${this.unityHubPath} -- --headless install \
|
||||
let command = `${this.unityHubPath} -- --headless install \
|
||||
--version ${buildParameters.editorVersion} \
|
||||
--changeset ${unityChangeset.changeset} \
|
||||
--module mac-il2cpp \
|
||||
--childModules`;
|
||||
--changeset ${unityChangeset.changeset} `;
|
||||
switch (buildParameters.targetPlatform) {
|
||||
case 'iOS':
|
||||
command += `--module ios `;
|
||||
break;
|
||||
case 'StandaloneOSX':
|
||||
command += `--module mac-il2cpp `;
|
||||
break;
|
||||
case 'android':
|
||||
command += `--module android `;
|
||||
break;
|
||||
}
|
||||
command += `--childModules`;
|
||||
// Ignoring return code because the log seems to overflow the internal buffer which triggers
|
||||
// a false error
|
||||
const errorCode = yield exec_1.exec(command, undefined, { silent, ignoreReturnCode: true });
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -63,17 +63,9 @@ else
|
|||
fi
|
||||
|
||||
#
|
||||
# Prepare Android keystore and SDK, if needed
|
||||
# Prepare Android SDK, if needed
|
||||
#
|
||||
|
||||
if [[ "$BUILD_TARGET" == "Android" && -n "$ANDROID_KEYSTORE_NAME" && -n "$ANDROID_KEYSTORE_BASE64" ]]; then
|
||||
echo "Creating Android keystore."
|
||||
echo "$ANDROID_KEYSTORE_BASE64" | base64 --decode > "$UNITY_PROJECT_PATH/$ANDROID_KEYSTORE_NAME"
|
||||
echo "Created Android keystore."
|
||||
else
|
||||
echo "Not creating Android keystore."
|
||||
fi
|
||||
|
||||
if [[ "$BUILD_TARGET" == "Android" && -n "$ANDROID_SDK_MANAGER_PARAMETERS" ]]; then
|
||||
echo "Updating Android SDK with parameters: $ANDROID_SDK_MANAGER_PARAMETERS"
|
||||
export JAVA_HOME="$(awk -F'=' '/JAVA_HOME=/{print $2}' /usr/bin/unity-editor.d/*)"
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ async function runMain() {
|
|||
|
||||
// Set output
|
||||
await Output.setBuildVersion(buildParameters.buildVersion);
|
||||
await Output.setAndroidVersionCode(buildParameters.androidVersionCode);
|
||||
} catch (error) {
|
||||
core.setFailed((error as Error).message);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class Docker {
|
|||
const { workspace, actionFolder, unitySerial, gitPrivateToken } = parameters;
|
||||
|
||||
return `docker run \
|
||||
--workdir /github/workspace \
|
||||
--workdir c:/github/workspace \
|
||||
--rm \
|
||||
${ImageEnvironmentFactory.getEnvVarString(parameters)} \
|
||||
--env UNITY_SERIAL="${unitySerial}" \
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ class ImageEnvironmentFactory {
|
|||
{ name: 'GITHUB_HEAD_REF', value: process.env.GITHUB_HEAD_REF },
|
||||
{ name: 'GITHUB_BASE_REF', value: process.env.GITHUB_BASE_REF },
|
||||
{ name: 'GITHUB_EVENT_NAME', value: process.env.GITHUB_EVENT_NAME },
|
||||
{ name: 'GITHUB_WORKSPACE', value: '/github/workspace' },
|
||||
{ name: 'GITHUB_ACTION', value: process.env.GITHUB_ACTION },
|
||||
{ name: 'GITHUB_EVENT_PATH', value: process.env.GITHUB_EVENT_PATH },
|
||||
{ name: 'RUNNER_OS', value: process.env.RUNNER_OS },
|
||||
|
|
|
|||
|
|
@ -7,3 +7,11 @@ describe('Output', () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Output', () => {
|
||||
describe('setAndroidVersionCode', () => {
|
||||
it('does not throw', async () => {
|
||||
await expect(Output.setAndroidVersionCode('1000')).resolves.not.toThrow();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,6 +4,10 @@ class Output {
|
|||
static async setBuildVersion(buildVersion) {
|
||||
await core.setOutput('buildVersion', buildVersion);
|
||||
}
|
||||
|
||||
static async setAndroidVersionCode(androidVersionCode) {
|
||||
await core.setOutput('androidVersionCode', androidVersionCode);
|
||||
}
|
||||
}
|
||||
|
||||
export default Output;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import fs from 'fs';
|
||||
import * as core from '@actions/core';
|
||||
import { BuildParameters } from '.';
|
||||
import { SetupMac, SetupWindows } from './platform-setup/';
|
||||
import { SetupMac, SetupWindows, SetupAndroid } from './platform-setup/';
|
||||
import ValidateWindows from './platform-validation/validate-windows';
|
||||
|
||||
class PlatformSetup {
|
||||
|
|
@ -33,6 +33,8 @@ class PlatformSetup {
|
|||
let servicesConfig = fs.readFileSync(servicesConfigPathTemplate).toString();
|
||||
servicesConfig = servicesConfig.replace('%URL%', buildParameters.unityLicensingServer);
|
||||
fs.writeFileSync(servicesConfigPath, servicesConfig);
|
||||
|
||||
SetupAndroid.setup(buildParameters);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import SetupWindows from './setup-windows';
|
||||
import SetupMac from './setup-mac';
|
||||
import SetupAndroid from './setup-android';
|
||||
|
||||
export { SetupWindows, SetupMac };
|
||||
export { SetupWindows, SetupMac, SetupAndroid };
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { BuildParameters } from '..';
|
||||
|
||||
class SetupAndroid {
|
||||
public static async setup(buildParameters: BuildParameters) {
|
||||
const { targetPlatform, androidKeystoreBase64, androidKeystoreName, projectPath } = buildParameters;
|
||||
|
||||
if (targetPlatform === 'Android' && androidKeystoreBase64 !== '' && androidKeystoreName !== '') {
|
||||
SetupAndroid.setupAndroidRun(androidKeystoreBase64, androidKeystoreName, projectPath);
|
||||
}
|
||||
}
|
||||
|
||||
private static setupAndroidRun(androidKeystoreBase64: string, androidKeystoreName: string, projectPath: string) {
|
||||
const decodedKeystore = Buffer.from(androidKeystoreBase64, 'base64').toString('binary');
|
||||
const githubWorkspace = process.env.GITHUB_WORKSPACE || '';
|
||||
fs.writeFileSync(path.join(githubWorkspace, projectPath, androidKeystoreName), decodedKeystore, 'binary');
|
||||
}
|
||||
}
|
||||
|
||||
export default SetupAndroid;
|
||||
|
|
@ -32,11 +32,23 @@ class SetupMac {
|
|||
|
||||
private static async installUnity(buildParameters: BuildParameters, silent = false) {
|
||||
const unityChangeset = await getUnityChangeset(buildParameters.editorVersion);
|
||||
const command = `${this.unityHubPath} -- --headless install \
|
||||
let command = `${this.unityHubPath} -- --headless install \
|
||||
--version ${buildParameters.editorVersion} \
|
||||
--changeset ${unityChangeset.changeset} \
|
||||
--module mac-il2cpp \
|
||||
--childModules`;
|
||||
--changeset ${unityChangeset.changeset} `;
|
||||
|
||||
switch (buildParameters.targetPlatform) {
|
||||
case 'iOS':
|
||||
command += `--module ios `;
|
||||
break;
|
||||
case 'StandaloneOSX':
|
||||
command += `--module mac-il2cpp `;
|
||||
break;
|
||||
case 'android':
|
||||
command += `--module android `;
|
||||
break;
|
||||
}
|
||||
|
||||
command += `--childModules`;
|
||||
|
||||
// Ignoring return code because the log seems to overflow the internal buffer which triggers
|
||||
// a false error
|
||||
|
|
|
|||
12
yarn.lock
12
yarn.lock
|
|
@ -3825,9 +3825,9 @@ json5@2.x, json5@^2.1.2:
|
|||
minimist "^1.2.5"
|
||||
|
||||
json5@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz"
|
||||
integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593"
|
||||
integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==
|
||||
dependencies:
|
||||
minimist "^1.2.0"
|
||||
|
||||
|
|
@ -4049,9 +4049,9 @@ minimatch@^3.0.4:
|
|||
brace-expansion "^1.1.7"
|
||||
|
||||
minimist@^1.2.0, minimist@^1.2.5:
|
||||
version "1.2.6"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
|
||||
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
|
||||
version "1.2.7"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18"
|
||||
integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==
|
||||
|
||||
minipass@^3.0.0:
|
||||
version "3.1.6"
|
||||
|
|
|
|||
Loading…
Reference in New Issue