implement simple retain workspaces command

pull/419/head
Frostebite 2022-08-20 03:37:41 +01:00
parent 781cfc8354
commit 46610398aa
4 changed files with 13 additions and 4 deletions

6
dist/index.js vendored
View File

@ -4733,6 +4733,7 @@ const core = __importStar(__nccwpck_require__(42186));
const cloud_runner_custom_hooks_1 = __nccwpck_require__(58873);
const path_1 = __importDefault(__nccwpck_require__(71017));
const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
class BuildAutomationWorkflow {
run(cloudRunnerStepState) {
return __awaiter(this, void 0, void 0, function* () {
@ -4827,7 +4828,10 @@ class BuildAutomationWorkflow {
node ${builderPath} -m cache-push --cachePushFrom ${cloud_runner_folders_1.CloudRunnerFolders.libraryFolderAbsolute} --artifactName lib-${guid} --cachePushTo ${linuxCacheFolder}/Library
echo "game ci cloud runner push build to cache"
node ${builderPath} -m cache-push --cachePushFrom ${cloud_runner_folders_1.CloudRunnerFolders.projectBuildFolderAbsolute} --artifactName build-${guid} --cachePushTo ${`${linuxCacheFolder}/build`.replace(/\\/g, `/`)}
rm -r ${cloud_runner_folders_1.CloudRunnerFolders.projectPathAbsolute}`;
${BuildAutomationWorkflow.GetCleanupCommand(cloud_runner_folders_1.CloudRunnerFolders.projectPathAbsolute)}`;
}
static GetCleanupCommand(cleanupPath) {
return cloud_runner_options_1.default.retainWorkspaces ? `` : `rm -r ${cleanupPath}`;
}
}
exports.BuildAutomationWorkflow = BuildAutomationWorkflow;

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -163,7 +163,7 @@ class CloudRunnerOptions {
return !input || input === 'true';
}
static get retainWorkspaces(): boolean {
public static get retainWorkspaces(): boolean {
return CloudRunnerOptions.getInput(`retainWorkspaces`) || false;
}

View File

@ -7,6 +7,7 @@ import * as core from '@actions/core';
import { CloudRunnerCustomHooks } from '../services/cloud-runner-custom-hooks';
import path from 'path';
import CloudRunner from '../cloud-runner';
import CloudRunnerOptions from '../cloud-runner-options';
export class BuildAutomationWorkflow implements WorkflowInterface {
async run(cloudRunnerStepState: CloudRunnerStepState) {
@ -120,6 +121,10 @@ export class BuildAutomationWorkflow implements WorkflowInterface {
node ${builderPath} -m cache-push --cachePushFrom ${
CloudRunnerFolders.projectBuildFolderAbsolute
} --artifactName build-${guid} --cachePushTo ${`${linuxCacheFolder}/build`.replace(/\\/g, `/`)}
rm -r ${CloudRunnerFolders.projectPathAbsolute}`;
${BuildAutomationWorkflow.GetCleanupCommand(CloudRunnerFolders.projectPathAbsolute)}`;
}
private static GetCleanupCommand(cleanupPath: string) {
return CloudRunnerOptions.retainWorkspaces ? `` : `rm -r ${cleanupPath}`;
}
}