Move to bash scripts for setup
parent
0b75d07586
commit
d8f6c81dd3
|
|
@ -1199,7 +1199,7 @@ exports.default = Kubernetes;
|
|||
/***/ }),
|
||||
|
||||
/***/ 39364:
|
||||
/***/ (function(__unused_webpack_module, exports) {
|
||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
|
@ -1213,13 +1213,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
const exec_1 = __webpack_require__(71514);
|
||||
class MacBuilder {
|
||||
static run(actionFolder, workspace, buildParameters) {
|
||||
static run(actionFolder, workspace, buildParameters, silent = false) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
//make linter happy
|
||||
if (actionFolder !== undefined && workspace !== undefined && buildParameters !== undefined) {
|
||||
return;
|
||||
}
|
||||
const command = `source ${actionFolder}/platforms/mac/entrypoint.sh`;
|
||||
yield exec_1.exec(command, undefined, { silent });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1329,44 +1328,42 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
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 exec_1 = __webpack_require__(71514);
|
||||
const fs_1 = __importDefault(__webpack_require__(35747));
|
||||
const unity_changeset_1 = __webpack_require__(4635);
|
||||
class SetupMac {
|
||||
//static unityHubPath = `/Applications/Unity\\\\ Hub.app/Contents/MacOS/Unity\\\\ Hub`;
|
||||
static setup(buildParameters) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const unityEditorPath = `/Applications/Unity/Hub/Editor/${buildParameters.version}/Unity.app/Contents/MacOS/Unity`;
|
||||
if (!fs_1.default.existsSync(unityEditorPath)) {
|
||||
yield SetupMac.installUnityHub();
|
||||
yield SetupMac.installUnity(buildParameters);
|
||||
}
|
||||
});
|
||||
}
|
||||
static installUnityHub(silent = false) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const command = 'brew install unity-hub';
|
||||
if (!fs_1.default.existsSync(this.unityHubPath)) {
|
||||
yield exec_1.exec(command, undefined, { silent });
|
||||
}
|
||||
});
|
||||
}
|
||||
static installUnity(buildParameters, silent = false) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const changeset = yield unity_changeset_1.getUnityChangeset(buildParameters.version).changeset;
|
||||
const command = `${this.unityHubPath} -- --headless install
|
||||
--version ${buildParameters.version}
|
||||
--changeset ${changeset}
|
||||
--module mac-il2cpp
|
||||
--childModules`;
|
||||
yield exec_1.exec(command, undefined, { silent });
|
||||
//Since we are using shell scripts on the host, we need to set the environment variables from here
|
||||
process.env.UNITY_VERSION = buildParameters.version;
|
||||
process.env.UNITY_CHANGESET = changeset;
|
||||
process.env.UNITY_SERIAL = buildParameters.unitySerial;
|
||||
process.env.PROJECT_PATH = buildParameters.projectPath;
|
||||
process.env.BUILD_TARGET = buildParameters.platform;
|
||||
process.env.BUILD_NAME = buildParameters.buildName;
|
||||
process.env.BUILD_PATH = buildParameters.buildPath;
|
||||
process.env.BUILD_FILE = buildParameters.buildFile;
|
||||
process.env.BUILD_METHOD = buildParameters.buildMethod;
|
||||
process.env.VERSION = buildParameters.buildVersion;
|
||||
process.env.ANDROID_VERSION_CODE = buildParameters.androidVersionCode;
|
||||
process.env.ANDROID_KEYSTORE_NAME = buildParameters.androidKeystoreName;
|
||||
process.env.ANDROID_KEYSTORE_BASE64 = buildParameters.androidKeystoreBase64;
|
||||
process.env.ANDROID_KEYSTORE_PASS = buildParameters.androidKeystorePass;
|
||||
process.env.ANDROID_KEYALIAS_NAME = buildParameters.androidKeyaliasName;
|
||||
process.env.ANDROID_KEYALIAS_PASS = buildParameters.androidKeyaliasPass;
|
||||
process.env.ANDROID_TARGET_SDK_VERSION = buildParameters.androidTargetSdkVersion;
|
||||
process.env.ANDROID_SDK_MANAGER_PARAMETERS = buildParameters.androidSdkManagerParameters;
|
||||
process.env.CUSTOM_PARAMETERS = buildParameters.customParameters;
|
||||
process.env.CHOWN_FILES_TO = buildParameters.chownFilesTo;
|
||||
// const unityEditorPath = `/Applications/Unity/Hub/Editor/${buildParameters.version}/Unity.app/Contents/MacOS/Unity`;
|
||||
// if (!fs.existsSync(unityEditorPath)) {
|
||||
// await SetupMac.installUnityHub();
|
||||
// await SetupMac.installUnity(buildParameters);
|
||||
// }
|
||||
});
|
||||
}
|
||||
}
|
||||
SetupMac.unityHubPath = `/Applications/Unity\\\\ Hub.app/Contents/MacOS/Unity\\\\ Hub`;
|
||||
exports.default = SetupMac;
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# Run steps
|
||||
#
|
||||
source /steps/setup.sh
|
||||
source /steps/activate.sh
|
||||
source /steps/build.sh
|
||||
source /steps/return_license.sh
|
||||
|
||||
#
|
||||
# Instructions for debugging
|
||||
#
|
||||
|
||||
if [[ $BUILD_EXIT_CODE -gt 0 ]]; then
|
||||
echo ""
|
||||
echo "###########################"
|
||||
echo "# Failure #"
|
||||
echo "###########################"
|
||||
echo ""
|
||||
echo "Please note that the exit code is not very descriptive."
|
||||
echo "Most likely it will not help you solve the issue."
|
||||
echo ""
|
||||
echo "To find the reason for failure: please search for errors in the log above."
|
||||
echo ""
|
||||
fi;
|
||||
|
||||
#
|
||||
# Exit with code from the build step.
|
||||
#
|
||||
|
||||
exit $BUILD_EXIT_CODE
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
echo "Requesting activation"
|
||||
|
||||
# Activate license
|
||||
/Applications/Unity/Hub/Editor/$UNITY_VERSION/Unity.app/Contents/MacOS/Unity \
|
||||
-logFile /dev/stdout \
|
||||
-quit \
|
||||
-serial "$UNITY_SERIAL" \
|
||||
-username "$UNITY_EMAIL" \
|
||||
-password "$UNITY_PASSWORD"
|
||||
|
||||
# Store the exit code from the verify command
|
||||
UNITY_EXIT_CODE=$?
|
||||
|
||||
#
|
||||
# Display information about the result
|
||||
#
|
||||
if [ $UNITY_EXIT_CODE -eq 0 ]; then
|
||||
# Activation was a success
|
||||
echo "Activation complete."
|
||||
else
|
||||
# Activation failed so exit with the code from the license verification step
|
||||
echo "Unclassified error occured while trying to activate license."
|
||||
echo "Exit code was: $UNITY_EXIT_CODE"
|
||||
exit $UNITY_EXIT_CODE
|
||||
fi
|
||||
|
||||
# Return to previous working directory
|
||||
popd
|
||||
|
|
@ -0,0 +1,186 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# Set project path
|
||||
#
|
||||
|
||||
UNITY_PROJECT_PATH="$GITHUB_WORKSPACE/$PROJECT_PATH"
|
||||
echo "Using project path \"$UNITY_PROJECT_PATH\"."
|
||||
|
||||
#
|
||||
# Display the name for the build, doubles as the output name
|
||||
#
|
||||
|
||||
echo "Using build name \"$BUILD_NAME\"."
|
||||
|
||||
#
|
||||
# Display the build's target platform;
|
||||
#
|
||||
|
||||
echo "Using build target \"$BUILD_TARGET\"."
|
||||
|
||||
#
|
||||
# Display build path and file
|
||||
#
|
||||
|
||||
echo "Using build path \"$BUILD_PATH\" to save file \"$BUILD_FILE\"."
|
||||
BUILD_PATH_FULL="$GITHUB_WORKSPACE/$BUILD_PATH"
|
||||
CUSTOM_BUILD_PATH="$BUILD_PATH_FULL/$BUILD_FILE"
|
||||
|
||||
#
|
||||
# Set the build method, must reference one of:
|
||||
#
|
||||
# - <NamespaceName.ClassName.MethodName>
|
||||
# - <ClassName.MethodName>
|
||||
#
|
||||
# For example: `BuildCommand.PerformBuild`
|
||||
#
|
||||
# The method must be declared static and placed in project/Assets/Editor
|
||||
#
|
||||
|
||||
if [ -z "$BUILD_METHOD" ]; then
|
||||
# User has not provided their own build command.
|
||||
#
|
||||
# Use the script from this action which builds the scenes that are enabled in
|
||||
# the project.
|
||||
#
|
||||
echo "Using built-in build method."
|
||||
# Create Editor directory if it does not exist
|
||||
mkdir -p "$UNITY_PROJECT_PATH/Assets/Editor/"
|
||||
# Copy the build script of Unity Builder action
|
||||
cp -R "/UnityBuilderAction/Assets/Editor/" "$UNITY_PROJECT_PATH/Assets/Editor/"
|
||||
# Set the Build method to that of UnityBuilder Action
|
||||
BUILD_METHOD="UnityBuilderAction.Builder.BuildProject"
|
||||
# Verify recursive paths
|
||||
ls -Ralph "$UNITY_PROJECT_PATH/Assets/Editor/"
|
||||
#
|
||||
else
|
||||
# User has provided their own build method.
|
||||
# Assume they also bring their own script.
|
||||
#
|
||||
echo "Using build method \"$BUILD_METHOD\"."
|
||||
#
|
||||
fi
|
||||
|
||||
#
|
||||
# Prepare Android keystore and 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/*)"
|
||||
"$(awk -F'=' '/ANDROID_HOME=/{print $2}' /usr/bin/unity-editor.d/*)/tools/bin/sdkmanager" "$ANDROID_SDK_MANAGER_PARAMETERS"
|
||||
echo "Updated Android SDK."
|
||||
else
|
||||
echo "Not updating Android SDK."
|
||||
fi
|
||||
|
||||
#
|
||||
# Pre-build debug information
|
||||
#
|
||||
|
||||
echo ""
|
||||
echo "###########################"
|
||||
echo "# Custom parameters #"
|
||||
echo "###########################"
|
||||
echo ""
|
||||
|
||||
echo "$CUSTOM_PARAMETERS"
|
||||
|
||||
echo ""
|
||||
echo "###########################"
|
||||
echo "# Current build dir #"
|
||||
echo "###########################"
|
||||
echo ""
|
||||
|
||||
echo "Creating \"$BUILD_PATH_FULL\" if it does not exist."
|
||||
mkdir -p "$BUILD_PATH_FULL"
|
||||
ls -alh "$BUILD_PATH_FULL"
|
||||
|
||||
echo ""
|
||||
echo "###########################"
|
||||
echo "# Project directory #"
|
||||
echo "###########################"
|
||||
echo ""
|
||||
|
||||
ls -alh "$UNITY_PROJECT_PATH"
|
||||
|
||||
#
|
||||
# Build
|
||||
#
|
||||
|
||||
echo ""
|
||||
echo "###########################"
|
||||
echo "# Building project #"
|
||||
echo "###########################"
|
||||
echo ""
|
||||
|
||||
# Reference: https://docs.unity3d.com/2019.3/Documentation/Manual/CommandLineArguments.html
|
||||
|
||||
/Applications/Unity/Hub/Editor/$UNITY_VERSION/Unity.app/Contents/MacOS/Unity \
|
||||
-logfile /dev/stdout \
|
||||
-quit \
|
||||
-customBuildName "$BUILD_NAME" \
|
||||
-projectPath "$UNITY_PROJECT_PATH" \
|
||||
-buildTarget "$BUILD_TARGET" \
|
||||
-customBuildTarget "$BUILD_TARGET" \
|
||||
-customBuildPath "$CUSTOM_BUILD_PATH" \
|
||||
-executeMethod "$BUILD_METHOD" \
|
||||
-buildVersion "$VERSION" \
|
||||
-androidVersionCode "$ANDROID_VERSION_CODE" \
|
||||
-androidKeystoreName "$ANDROID_KEYSTORE_NAME" \
|
||||
-androidKeystorePass "$ANDROID_KEYSTORE_PASS" \
|
||||
-androidKeyaliasName "$ANDROID_KEYALIAS_NAME" \
|
||||
-androidKeyaliasPass "$ANDROID_KEYALIAS_PASS" \
|
||||
-androidTargetSdkVersion "$ANDROID_TARGET_SDK_VERSION" \
|
||||
$CUSTOM_PARAMETERS
|
||||
|
||||
# Catch exit code
|
||||
BUILD_EXIT_CODE=$?
|
||||
|
||||
# Display results
|
||||
if [ $BUILD_EXIT_CODE -eq 0 ]; then
|
||||
echo "Build succeeded";
|
||||
else
|
||||
echo "Build failed, with exit code $BUILD_EXIT_CODE";
|
||||
fi
|
||||
|
||||
#
|
||||
# Permissions
|
||||
#
|
||||
|
||||
# Make a given user owner of all artifacts
|
||||
if [[ -n "$CHOWN_FILES_TO" ]]; then
|
||||
chown -R "$CHOWN_FILES_TO" "$BUILD_PATH_FULL"
|
||||
chown -R "$CHOWN_FILES_TO" "$UNITY_PROJECT_PATH"
|
||||
fi
|
||||
|
||||
# Add read permissions for everyone to all artifacts
|
||||
chmod -R a+r "$BUILD_PATH_FULL"
|
||||
chmod -R a+r "$UNITY_PROJECT_PATH"
|
||||
|
||||
# Add execute permissions to specific files
|
||||
if [[ "$BUILD_TARGET" == "StandaloneOSX" ]]; then
|
||||
OSX_EXECUTABLE_PATH="$BUILD_PATH_FULL/$BUILD_NAME.app/Contents/MacOS"
|
||||
find "$OSX_EXECUTABLE_PATH" -type f -exec chmod +x {} \;
|
||||
fi
|
||||
|
||||
#
|
||||
# Results
|
||||
#
|
||||
|
||||
echo ""
|
||||
echo "###########################"
|
||||
echo "# Build output #"
|
||||
echo "###########################"
|
||||
echo ""
|
||||
|
||||
ls -alh "$BUILD_PATH_FULL"
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
/Applications/Unity/Hub/Editor/$UNITY_VERSION/Unity.app/Contents/MacOS/Unity \
|
||||
-logFile /dev/stdout \
|
||||
-quit \
|
||||
-returnlicense
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
echo "Installing Unity Hub"
|
||||
|
||||
brew install unity-hub
|
||||
|
||||
echo "Installing Unity Editor $UNITY_VERSION ($UNITY_CHANGESET)"
|
||||
|
||||
/Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless install
|
||||
--version $UNITY_VERSION
|
||||
--changeset $UNITY_CHANGESET
|
||||
--module mac-il2cpp
|
||||
--childModules
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
import { exec } from '@actions/exec';
|
||||
import { BuildParameters } from '.';
|
||||
|
||||
class MacBuilder {
|
||||
public static async run(actionFolder, workspace, buildParameters: BuildParameters) {
|
||||
//make linter happy
|
||||
if (actionFolder !== undefined && workspace !== undefined && buildParameters !== undefined) {
|
||||
return;
|
||||
}
|
||||
public static async run(actionFolder, workspace, buildParameters: BuildParameters, silent = false) {
|
||||
const command = `source ${actionFolder}/platforms/mac/entrypoint.sh`;
|
||||
await exec(command, undefined, { silent });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,35 +1,55 @@
|
|||
import { exec } from '@actions/exec';
|
||||
import fs from 'fs';
|
||||
import { BuildParameters } from '..';
|
||||
import { getUnityChangeset } from 'unity-changeset';
|
||||
|
||||
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) {
|
||||
const unityEditorPath = `/Applications/Unity/Hub/Editor/${buildParameters.version}/Unity.app/Contents/MacOS/Unity`;
|
||||
if (!fs.existsSync(unityEditorPath)) {
|
||||
await SetupMac.installUnityHub();
|
||||
await SetupMac.installUnity(buildParameters);
|
||||
}
|
||||
}
|
||||
|
||||
private static async installUnityHub(silent = false) {
|
||||
const command = 'brew install unity-hub';
|
||||
if (!fs.existsSync(this.unityHubPath)) {
|
||||
await exec(command, undefined, { silent });
|
||||
}
|
||||
}
|
||||
|
||||
private static async installUnity(buildParameters: BuildParameters, silent = false) {
|
||||
const changeset = await getUnityChangeset(buildParameters.version).changeset;
|
||||
const command = `${this.unityHubPath} -- --headless install
|
||||
--version ${buildParameters.version}
|
||||
--changeset ${changeset}
|
||||
--module mac-il2cpp
|
||||
--childModules`;
|
||||
await exec(command, undefined, { silent });
|
||||
//Since we are using shell scripts on the host, we need to set the environment variables from here
|
||||
process.env.UNITY_VERSION = buildParameters.version;
|
||||
process.env.UNITY_CHANGESET = changeset;
|
||||
process.env.UNITY_SERIAL = buildParameters.unitySerial;
|
||||
process.env.PROJECT_PATH = buildParameters.projectPath;
|
||||
process.env.BUILD_TARGET = buildParameters.platform;
|
||||
process.env.BUILD_NAME = buildParameters.buildName;
|
||||
process.env.BUILD_PATH = buildParameters.buildPath;
|
||||
process.env.BUILD_FILE = buildParameters.buildFile;
|
||||
process.env.BUILD_METHOD = buildParameters.buildMethod;
|
||||
process.env.VERSION = buildParameters.buildVersion;
|
||||
process.env.ANDROID_VERSION_CODE = buildParameters.androidVersionCode;
|
||||
process.env.ANDROID_KEYSTORE_NAME = buildParameters.androidKeystoreName;
|
||||
process.env.ANDROID_KEYSTORE_BASE64 = buildParameters.androidKeystoreBase64;
|
||||
process.env.ANDROID_KEYSTORE_PASS = buildParameters.androidKeystorePass;
|
||||
process.env.ANDROID_KEYALIAS_NAME = buildParameters.androidKeyaliasName;
|
||||
process.env.ANDROID_KEYALIAS_PASS = buildParameters.androidKeyaliasPass;
|
||||
process.env.ANDROID_TARGET_SDK_VERSION = buildParameters.androidTargetSdkVersion;
|
||||
process.env.ANDROID_SDK_MANAGER_PARAMETERS = buildParameters.androidSdkManagerParameters;
|
||||
process.env.CUSTOM_PARAMETERS = buildParameters.customParameters;
|
||||
process.env.CHOWN_FILES_TO = buildParameters.chownFilesTo;
|
||||
// const unityEditorPath = `/Applications/Unity/Hub/Editor/${buildParameters.version}/Unity.app/Contents/MacOS/Unity`;
|
||||
// if (!fs.existsSync(unityEditorPath)) {
|
||||
// await SetupMac.installUnityHub();
|
||||
// await SetupMac.installUnity(buildParameters);
|
||||
// }
|
||||
}
|
||||
|
||||
// private static async installUnityHub(silent = false) {
|
||||
// const command = 'brew install unity-hub';
|
||||
// if (!fs.existsSync(this.unityHubPath)) {
|
||||
// await exec(command, undefined, { silent });
|
||||
// }
|
||||
// }
|
||||
|
||||
// private static async installUnity(buildParameters: BuildParameters, silent = false) {
|
||||
|
||||
// const command = `${this.unityHubPath} -- --headless install
|
||||
// --version ${buildParameters.version}
|
||||
// --changeset ${changeset}
|
||||
// --module mac-il2cpp
|
||||
// --childModules`;
|
||||
// await exec(command, undefined, { silent });
|
||||
// }
|
||||
}
|
||||
|
||||
export default SetupMac;
|
||||
|
|
|
|||
Loading…
Reference in New Issue