Fix #433
parent
a8de72a2dd
commit
024cb43c29
|
@ -211,6 +211,12 @@ inputs:
|
|||
default: ''
|
||||
required: false
|
||||
description: 'The Unity licensing server address to use for activating Unity.'
|
||||
dockerWorkspacePath:
|
||||
default: '/github/workspace'
|
||||
required: false
|
||||
description:
|
||||
'The path to mount the workspace inside the docker container. For windows, leave out the drive letter. For example
|
||||
c:/github/workspace should be defined as /github/workspace'
|
||||
|
||||
outputs:
|
||||
volume:
|
||||
|
|
|
@ -302,6 +302,7 @@ class BuildParameters {
|
|||
githubChecks: cloud_runner_options_1.default.githubChecks,
|
||||
cacheUnityInstallationOnMac: input_1.default.cacheUnityInstallationOnMac,
|
||||
unityHubVersionOnMac: input_1.default.unityHubVersionOnMac,
|
||||
dockerWorkspacePath: input_1.default.dockerWorkspacePath,
|
||||
};
|
||||
}
|
||||
static parseBuildFile(filename, platform, androidExportType) {
|
||||
|
@ -5712,7 +5713,7 @@ class Docker {
|
|||
}
|
||||
}
|
||||
static getLinuxCommand(image, parameters, overrideCommands = '', additionalVariables = [], entrypointBash = false) {
|
||||
const { workspace, actionFolder, runnerTempPath, sshAgent, gitPrivateToken } = parameters;
|
||||
const { workspace, actionFolder, runnerTempPath, sshAgent, gitPrivateToken, dockerWorkspacePath } = parameters;
|
||||
const githubHome = node_path_1.default.join(runnerTempPath, '_github_home');
|
||||
if (!node_fs_1.existsSync(githubHome))
|
||||
node_fs_1.mkdirSync(githubHome);
|
||||
|
@ -5721,16 +5722,16 @@ class Docker {
|
|||
node_fs_1.mkdirSync(githubWorkflow);
|
||||
const commandPrefix = image === `alpine` ? `/bin/sh` : `/bin/bash`;
|
||||
return `docker run \
|
||||
--workdir /github/workspace \
|
||||
--workdir ${dockerWorkspacePath} \
|
||||
--rm \
|
||||
${image_environment_factory_1.default.getEnvVarString(parameters, additionalVariables)} \
|
||||
--env UNITY_SERIAL \
|
||||
--env GITHUB_WORKSPACE=/github/workspace \
|
||||
--env GITHUB_WORKSPACE=${dockerWorkspacePath} \
|
||||
${gitPrivateToken ? `--env GIT_PRIVATE_TOKEN="${gitPrivateToken}"` : ''} \
|
||||
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
|
||||
--volume "${githubHome}":"/root:z" \
|
||||
--volume "${githubWorkflow}":"/github/workflow:z" \
|
||||
--volume "${workspace}":"/github/workspace:z" \
|
||||
--volume "${workspace}":"${dockerWorkspacePath}:z" \
|
||||
--volume "${actionFolder}/default-build-script:/UnityBuilderAction:z" \
|
||||
--volume "${actionFolder}/platforms/ubuntu/steps:/steps:z" \
|
||||
--volume "${actionFolder}/platforms/ubuntu/entrypoint.sh:/entrypoint.sh:z" \
|
||||
|
@ -5743,15 +5744,15 @@ class Docker {
|
|||
"${overrideCommands !== '' ? overrideCommands : `/entrypoint.sh`}"`;
|
||||
}
|
||||
static getWindowsCommand(image, parameters) {
|
||||
const { workspace, actionFolder, unitySerial, gitPrivateToken } = parameters;
|
||||
const { workspace, actionFolder, unitySerial, gitPrivateToken, dockerWorkspacePath } = parameters;
|
||||
return `docker run \
|
||||
--workdir c:/github/workspace \
|
||||
--workdir c:${dockerWorkspacePath} \
|
||||
--rm \
|
||||
${image_environment_factory_1.default.getEnvVarString(parameters)} \
|
||||
--env UNITY_SERIAL="${unitySerial}" \
|
||||
--env GITHUB_WORKSPACE=c:/github/workspace \
|
||||
--env GITHUB_WORKSPACE=c:${dockerWorkspacePath} \
|
||||
${gitPrivateToken ? `--env GIT_PRIVATE_TOKEN="${gitPrivateToken}"` : ''} \
|
||||
--volume "${workspace}":"c:/github/workspace" \
|
||||
--volume "${workspace}":"c:${dockerWorkspacePath}" \
|
||||
--volume "c:/regkeys":"c:/regkeys" \
|
||||
--volume "C:/Program Files (x86)/Microsoft Visual Studio":"C:/Program Files (x86)/Microsoft Visual Studio" \
|
||||
--volume "C:/Program Files (x86)/Windows Kits":"C:/Program Files (x86)/Windows Kits" \
|
||||
|
@ -6681,6 +6682,9 @@ class Input {
|
|||
static get unityLicense() {
|
||||
return Input.getInput('UNITY_LICENSE');
|
||||
}
|
||||
static get dockerWorkspacePath() {
|
||||
return Input.getInput('dockerWorkspacePath') || '/github/workspace';
|
||||
}
|
||||
static ToEnvVarFormat(input) {
|
||||
if (input.toUpperCase() === input) {
|
||||
return input;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -79,6 +79,7 @@ class BuildParameters {
|
|||
public githubChecks!: boolean;
|
||||
public cacheUnityInstallationOnMac!: boolean;
|
||||
public unityHubVersionOnMac!: string;
|
||||
public dockerWorkspacePath!: string;
|
||||
|
||||
static async create(): Promise<BuildParameters> {
|
||||
const buildFile = this.parseBuildFile(Input.buildName, Input.targetPlatform, Input.androidExportType);
|
||||
|
@ -179,6 +180,7 @@ class BuildParameters {
|
|||
githubChecks: CloudRunnerOptions.githubChecks,
|
||||
cacheUnityInstallationOnMac: Input.cacheUnityInstallationOnMac,
|
||||
unityHubVersionOnMac: Input.unityHubVersionOnMac,
|
||||
dockerWorkspacePath: Input.dockerWorkspacePath,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ class Docker {
|
|||
additionalVariables: StringKeyValuePair[] = [],
|
||||
entrypointBash: boolean = false,
|
||||
): string {
|
||||
const { workspace, actionFolder, runnerTempPath, sshAgent, gitPrivateToken } = parameters;
|
||||
const { workspace, actionFolder, runnerTempPath, sshAgent, gitPrivateToken, dockerWorkspacePath } = parameters;
|
||||
|
||||
const githubHome = path.join(runnerTempPath, '_github_home');
|
||||
if (!existsSync(githubHome)) mkdirSync(githubHome);
|
||||
|
@ -48,16 +48,16 @@ class Docker {
|
|||
const commandPrefix = image === `alpine` ? `/bin/sh` : `/bin/bash`;
|
||||
|
||||
return `docker run \
|
||||
--workdir /github/workspace \
|
||||
--workdir ${dockerWorkspacePath} \
|
||||
--rm \
|
||||
${ImageEnvironmentFactory.getEnvVarString(parameters, additionalVariables)} \
|
||||
--env UNITY_SERIAL \
|
||||
--env GITHUB_WORKSPACE=/github/workspace \
|
||||
--env GITHUB_WORKSPACE=${dockerWorkspacePath} \
|
||||
${gitPrivateToken ? `--env GIT_PRIVATE_TOKEN="${gitPrivateToken}"` : ''} \
|
||||
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
|
||||
--volume "${githubHome}":"/root:z" \
|
||||
--volume "${githubWorkflow}":"/github/workflow:z" \
|
||||
--volume "${workspace}":"/github/workspace:z" \
|
||||
--volume "${workspace}":"${dockerWorkspacePath}:z" \
|
||||
--volume "${actionFolder}/default-build-script:/UnityBuilderAction:z" \
|
||||
--volume "${actionFolder}/platforms/ubuntu/steps:/steps:z" \
|
||||
--volume "${actionFolder}/platforms/ubuntu/entrypoint.sh:/entrypoint.sh:z" \
|
||||
|
@ -71,16 +71,16 @@ class Docker {
|
|||
}
|
||||
|
||||
static getWindowsCommand(image: string, parameters: DockerParameters): string {
|
||||
const { workspace, actionFolder, unitySerial, gitPrivateToken } = parameters;
|
||||
const { workspace, actionFolder, unitySerial, gitPrivateToken, dockerWorkspacePath } = parameters;
|
||||
|
||||
return `docker run \
|
||||
--workdir c:/github/workspace \
|
||||
--workdir c:${dockerWorkspacePath} \
|
||||
--rm \
|
||||
${ImageEnvironmentFactory.getEnvVarString(parameters)} \
|
||||
--env UNITY_SERIAL="${unitySerial}" \
|
||||
--env GITHUB_WORKSPACE=c:/github/workspace \
|
||||
--env GITHUB_WORKSPACE=c:${dockerWorkspacePath} \
|
||||
${gitPrivateToken ? `--env GIT_PRIVATE_TOKEN="${gitPrivateToken}"` : ''} \
|
||||
--volume "${workspace}":"c:/github/workspace" \
|
||||
--volume "${workspace}":"c:${dockerWorkspacePath}" \
|
||||
--volume "c:/regkeys":"c:/regkeys" \
|
||||
--volume "C:/Program Files (x86)/Microsoft Visual Studio":"C:/Program Files (x86)/Microsoft Visual Studio" \
|
||||
--volume "C:/Program Files (x86)/Windows Kits":"C:/Program Files (x86)/Windows Kits" \
|
||||
|
|
|
@ -236,6 +236,10 @@ class Input {
|
|||
return Input.getInput('UNITY_LICENSE');
|
||||
}
|
||||
|
||||
static get dockerWorkspacePath(): string {
|
||||
return Input.getInput('dockerWorkspacePath') || '/github/workspace';
|
||||
}
|
||||
|
||||
public static ToEnvVarFormat(input: string) {
|
||||
if (input.toUpperCase() === input) {
|
||||
return input;
|
||||
|
|
Loading…
Reference in New Issue