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