Revert to cwd being the workspace folder and pass action folder as an env variable.
parent
40463d3b61
commit
f652a90039
|
|
@ -64,7 +64,7 @@ function run() {
|
||||||
// default and local case
|
// default and local case
|
||||||
default:
|
default:
|
||||||
core.info('Building locally');
|
core.info('Building locally');
|
||||||
yield platform_setup_1.default.setup(buildParameters);
|
yield platform_setup_1.default.setup(buildParameters, actionFolder);
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
mac_builder_1.default.run(actionFolder, workspace, buildParameters);
|
mac_builder_1.default.run(actionFolder, workspace, buildParameters);
|
||||||
}
|
}
|
||||||
|
|
@ -1219,7 +1219,6 @@ class MacBuilder {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
yield exec_1.exec('bash', [`${actionFolder}/platforms/mac/entrypoint.sh`], {
|
yield exec_1.exec('bash', [`${actionFolder}/platforms/mac/entrypoint.sh`], {
|
||||||
silent,
|
silent,
|
||||||
cwd: `${actionFolder}/platforms/mac`,
|
|
||||||
ignoreReturnCode: true,
|
ignoreReturnCode: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -1279,7 +1278,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const platform_setup_1 = __webpack_require__(2014);
|
const platform_setup_1 = __webpack_require__(2014);
|
||||||
const validate_windows_1 = __importDefault(__webpack_require__(41563));
|
const validate_windows_1 = __importDefault(__webpack_require__(41563));
|
||||||
class PlatformSetup {
|
class PlatformSetup {
|
||||||
static setup(buildParameters) {
|
static setup(buildParameters, actionFolder) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
|
|
@ -1287,7 +1286,7 @@ class PlatformSetup {
|
||||||
platform_setup_1.SetupWindows.setup(buildParameters);
|
platform_setup_1.SetupWindows.setup(buildParameters);
|
||||||
break;
|
break;
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
yield platform_setup_1.SetupMac.setup(buildParameters);
|
yield platform_setup_1.SetupMac.setup(buildParameters, actionFolder);
|
||||||
break;
|
break;
|
||||||
//Add other baseOS's here
|
//Add other baseOS's here
|
||||||
}
|
}
|
||||||
|
|
@ -1339,22 +1338,27 @@ const unity_changeset_1 = __webpack_require__(4635);
|
||||||
const exec_1 = __webpack_require__(71514);
|
const exec_1 = __webpack_require__(71514);
|
||||||
const fs_1 = __importDefault(__webpack_require__(35747));
|
const fs_1 = __importDefault(__webpack_require__(35747));
|
||||||
class SetupMac {
|
class SetupMac {
|
||||||
static setup(buildParameters) {
|
static setup(buildParameters, actionFolder) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const unityEditorPath = `/Applications/Unity/Hub/Editor/${buildParameters.version}/Unity.app/Contents/MacOS/Unity`;
|
const unityEditorPath = `/Applications/Unity/Hub/Editor/${buildParameters.version}/Unity.app/Contents/MacOS/Unity`;
|
||||||
yield exec_1.exec('pwd');
|
// Only install unity if the editor doesn't already exist
|
||||||
if (!fs_1.default.existsSync(unityEditorPath)) {
|
if (!fs_1.default.existsSync(unityEditorPath)) {
|
||||||
yield SetupMac.installUnityHub();
|
yield SetupMac.installUnityHub();
|
||||||
yield SetupMac.installUnity(buildParameters);
|
yield SetupMac.installUnity(buildParameters);
|
||||||
}
|
}
|
||||||
yield SetupMac.setEnvironmentVariables(buildParameters);
|
yield SetupMac.setEnvironmentVariables(buildParameters, actionFolder);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static installUnityHub(silent = false) {
|
static installUnityHub(silent = false) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const command = 'brew install unity-hub';
|
const command = 'brew install unity-hub';
|
||||||
if (!fs_1.default.existsSync(this.unityHubPath)) {
|
if (!fs_1.default.existsSync(this.unityHubPath)) {
|
||||||
yield exec_1.exec(command, undefined, { silent, ignoreReturnCode: true });
|
//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 });
|
||||||
|
if (errorCode) {
|
||||||
|
throw new Error(`There was an error installing the Unity Editor. See logs above for details.`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -1366,16 +1370,19 @@ class SetupMac {
|
||||||
--changeset ${unityChangeset.changeset} \
|
--changeset ${unityChangeset.changeset} \
|
||||||
--module mac-il2cpp \
|
--module mac-il2cpp \
|
||||||
--childModules`;
|
--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 });
|
const errorCode = yield exec_1.exec(command, undefined, { silent, ignoreReturnCode: true });
|
||||||
if (errorCode) {
|
if (errorCode) {
|
||||||
throw new Error(`There was an error installing the Unity Editor. See logs above for details.`);
|
throw new Error(`There was an error installing the Unity Editor. See logs above for details.`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static setEnvironmentVariables(buildParameters) {
|
static setEnvironmentVariables(buildParameters, actionFolder) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
//Need to set environment variables from here because we execute
|
//Need to set environment variables from here because we execute
|
||||||
//the scripts on the host for mac
|
//the scripts on the host for mac
|
||||||
|
process.env.ACTION_FOLDER = actionFolder;
|
||||||
process.env.UNITY_VERSION = buildParameters.version;
|
process.env.UNITY_VERSION = buildParameters.version;
|
||||||
process.env.UNITY_SERIAL = buildParameters.unitySerial;
|
process.env.UNITY_SERIAL = buildParameters.unitySerial;
|
||||||
process.env.PROJECT_PATH = buildParameters.projectPath;
|
process.env.PROJECT_PATH = buildParameters.projectPath;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1,24 +1,28 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
#
|
#
|
||||||
# Create directory for license activation
|
# Create directories for license activation
|
||||||
#
|
#
|
||||||
|
|
||||||
sudo mkdir /Library/Application\ Support/Unity
|
sudo mkdir /Library/Application\ Support/Unity
|
||||||
sudo chmod -R 777 /Library/Application\ Support/Unity
|
sudo chmod -R 777 /Library/Application\ Support/Unity
|
||||||
|
|
||||||
|
ACTIVATE_LICENSE_PATH="$GITHUB_WORKSPACE/_activate-license"
|
||||||
|
mkdir -p "$ACTIVATE_LICENSE_PATH"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Run steps
|
# Run steps
|
||||||
#
|
#
|
||||||
source ./steps/activate.sh
|
source $ACTION_FOLDER/platforms/mac/steps/activate.sh
|
||||||
source ./steps/build.sh
|
source $ACTION_FOLDER/platforms/mac/steps/build.sh
|
||||||
source ./steps/return_license.sh
|
source $ACTION_FOLDER/platforms/mac/steps/return_license.sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Remove license activation directory
|
# Remove license activation directory
|
||||||
#
|
#
|
||||||
|
|
||||||
sudo rm -r /Library/Application\ Support/Unity
|
sudo rm -r /Library/Application\ Support/Unity
|
||||||
|
rm -r "$ACTIVATE_LICENSE_PATH"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Instructions for debugging
|
# Instructions for debugging
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Run in ACTIVATE_LICENSE_PATH directory
|
||||||
|
echo "Changing to \"$ACTIVATE_LICENSE_PATH\" directory."
|
||||||
|
pushd "$ACTIVATE_LICENSE_PATH"
|
||||||
|
|
||||||
echo "Requesting activation"
|
echo "Requesting activation"
|
||||||
|
|
||||||
# Activate license
|
# Activate license
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Need this because it tries to initialize the library when deactivating
|
# Run in ACTIVATE_LICENSE_PATH directory
|
||||||
UNITY_PROJECT_PATH="$GITHUB_WORKSPACE/$PROJECT_PATH"
|
echo "Changing to \"$ACTIVATE_LICENSE_PATH\" directory."
|
||||||
|
pushd "$ACTIVATE_LICENSE_PATH"
|
||||||
|
|
||||||
/Applications/Unity/Hub/Editor/$UNITY_VERSION/Unity.app/Contents/MacOS/Unity \
|
/Applications/Unity/Hub/Editor/$UNITY_VERSION/Unity.app/Contents/MacOS/Unity \
|
||||||
-logFile /dev/stdout \
|
-logFile /dev/stdout \
|
||||||
|
|
@ -9,3 +10,6 @@ UNITY_PROJECT_PATH="$GITHUB_WORKSPACE/$PROJECT_PATH"
|
||||||
-nographics \
|
-nographics \
|
||||||
-quit \
|
-quit \
|
||||||
-returnlicense
|
-returnlicense
|
||||||
|
|
||||||
|
# Return to previous working directory
|
||||||
|
popd
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ async function run() {
|
||||||
// default and local case
|
// default and local case
|
||||||
default:
|
default:
|
||||||
core.info('Building locally');
|
core.info('Building locally');
|
||||||
await PlatformSetup.setup(buildParameters);
|
await PlatformSetup.setup(buildParameters, actionFolder);
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
MacBuilder.run(actionFolder, workspace, buildParameters);
|
MacBuilder.run(actionFolder, workspace, buildParameters);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ class MacBuilder {
|
||||||
public static async run(actionFolder, workspace, buildParameters: BuildParameters, silent = false) {
|
public static async run(actionFolder, workspace, buildParameters: BuildParameters, silent = false) {
|
||||||
await exec('bash', [`${actionFolder}/platforms/mac/entrypoint.sh`], {
|
await exec('bash', [`${actionFolder}/platforms/mac/entrypoint.sh`], {
|
||||||
silent,
|
silent,
|
||||||
cwd: `${actionFolder}/platforms/mac`,
|
|
||||||
ignoreReturnCode: true,
|
ignoreReturnCode: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,14 @@ import { SetupWindows, SetupMac } from './platform-setup/';
|
||||||
import ValidateWindows from './platform-validation/validate-windows';
|
import ValidateWindows from './platform-validation/validate-windows';
|
||||||
|
|
||||||
class PlatformSetup {
|
class PlatformSetup {
|
||||||
static async setup(buildParameters: BuildParameters) {
|
static async setup(buildParameters: BuildParameters, actionFolder: string) {
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
ValidateWindows.validate(buildParameters);
|
ValidateWindows.validate(buildParameters);
|
||||||
SetupWindows.setup(buildParameters);
|
SetupWindows.setup(buildParameters);
|
||||||
break;
|
break;
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
await SetupMac.setup(buildParameters);
|
await SetupMac.setup(buildParameters, actionFolder);
|
||||||
break;
|
break;
|
||||||
//Add other baseOS's here
|
//Add other baseOS's here
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,20 +5,28 @@ import fs from 'fs';
|
||||||
|
|
||||||
class SetupMac {
|
class SetupMac {
|
||||||
static unityHubPath = `"/Applications/Unity Hub.app/Contents/MacOS/Unity Hub"`;
|
static unityHubPath = `"/Applications/Unity Hub.app/Contents/MacOS/Unity Hub"`;
|
||||||
public static async setup(buildParameters: BuildParameters) {
|
|
||||||
|
public static async setup(buildParameters: BuildParameters, actionFolder: string) {
|
||||||
const unityEditorPath = `/Applications/Unity/Hub/Editor/${buildParameters.version}/Unity.app/Contents/MacOS/Unity`;
|
const unityEditorPath = `/Applications/Unity/Hub/Editor/${buildParameters.version}/Unity.app/Contents/MacOS/Unity`;
|
||||||
await exec('pwd');
|
|
||||||
|
// Only install unity if the editor doesn't already exist
|
||||||
if (!fs.existsSync(unityEditorPath)) {
|
if (!fs.existsSync(unityEditorPath)) {
|
||||||
await SetupMac.installUnityHub();
|
await SetupMac.installUnityHub();
|
||||||
await SetupMac.installUnity(buildParameters);
|
await SetupMac.installUnity(buildParameters);
|
||||||
}
|
}
|
||||||
await SetupMac.setEnvironmentVariables(buildParameters);
|
|
||||||
|
await SetupMac.setEnvironmentVariables(buildParameters, actionFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async installUnityHub(silent = false) {
|
private static async installUnityHub(silent = false) {
|
||||||
const command = 'brew install unity-hub';
|
const command = 'brew install unity-hub';
|
||||||
if (!fs.existsSync(this.unityHubPath)) {
|
if (!fs.existsSync(this.unityHubPath)) {
|
||||||
await exec(command, undefined, { silent, ignoreReturnCode: true });
|
//Ignoring return code because the log seems to overflow the internal buffer which triggers
|
||||||
|
//a false error
|
||||||
|
const errorCode = await exec(command, undefined, { silent, ignoreReturnCode: true });
|
||||||
|
if (errorCode) {
|
||||||
|
throw new Error(`There was an error installing the Unity Editor. See logs above for details.`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -29,15 +37,19 @@ class SetupMac {
|
||||||
--changeset ${unityChangeset.changeset} \
|
--changeset ${unityChangeset.changeset} \
|
||||||
--module mac-il2cpp \
|
--module mac-il2cpp \
|
||||||
--childModules`;
|
--childModules`;
|
||||||
|
|
||||||
|
//Ignoring return code because the log seems to overflow the internal buffer which triggers
|
||||||
|
//a false error
|
||||||
const errorCode = await exec(command, undefined, { silent, ignoreReturnCode: true });
|
const errorCode = await exec(command, undefined, { silent, ignoreReturnCode: true });
|
||||||
if (errorCode) {
|
if (errorCode) {
|
||||||
throw new Error(`There was an error installing the Unity Editor. See logs above for details.`);
|
throw new Error(`There was an error installing the Unity Editor. See logs above for details.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async setEnvironmentVariables(buildParameters: BuildParameters) {
|
private static async setEnvironmentVariables(buildParameters: BuildParameters, actionFolder: string) {
|
||||||
//Need to set environment variables from here because we execute
|
//Need to set environment variables from here because we execute
|
||||||
//the scripts on the host for mac
|
//the scripts on the host for mac
|
||||||
|
process.env.ACTION_FOLDER = actionFolder;
|
||||||
process.env.UNITY_VERSION = buildParameters.version;
|
process.env.UNITY_VERSION = buildParameters.version;
|
||||||
process.env.UNITY_SERIAL = buildParameters.unitySerial;
|
process.env.UNITY_SERIAL = buildParameters.unitySerial;
|
||||||
process.env.PROJECT_PATH = buildParameters.projectPath;
|
process.env.PROJECT_PATH = buildParameters.projectPath;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue