Move shell scripts into remote-cli
parent
8180c2c47d
commit
ccfd3cdb2d
|
|
@ -86,10 +86,15 @@ function runRemoteCli(options) {
|
||||||
}
|
}
|
||||||
const program = new commander_ts_1.Command();
|
const program = new commander_ts_1.Command();
|
||||||
program.version('0.0.1');
|
program.version('0.0.1');
|
||||||
|
const properties = Object.getOwnPropertyNames(model_1.Input);
|
||||||
|
core.info(`\n`);
|
||||||
|
core.info(`INPUT:`);
|
||||||
|
for (const element of properties) {
|
||||||
|
program.option(`--${element} <${element}>`, 'default description');
|
||||||
|
core.info(element);
|
||||||
|
}
|
||||||
|
core.info(`\n`);
|
||||||
program.option('-m, --mode <mode>', 'cli or default');
|
program.option('-m, --mode <mode>', 'cli or default');
|
||||||
program.option('-region, --region <region>', 'aws region');
|
|
||||||
program.option('-b, --branch <branch>', 'unity builder branch to clone');
|
|
||||||
program.option('-sN, --awsBaseStackName <awsBaseStackName>', 'aws stack name');
|
|
||||||
program.parse(process.argv);
|
program.parse(process.argv);
|
||||||
const options = program.opts();
|
const options = program.opts();
|
||||||
process.env.AWS_REGION = options.region;
|
process.env.AWS_REGION = options.region;
|
||||||
|
|
@ -280,6 +285,7 @@ class BuildParameters {
|
||||||
customBuildSteps: input_1.default.customBuildSteps,
|
customBuildSteps: input_1.default.customBuildSteps,
|
||||||
runNumber: input_1.default.runNumber,
|
runNumber: input_1.default.runNumber,
|
||||||
branch: input_1.default.branch,
|
branch: input_1.default.branch,
|
||||||
|
githubRepo: input_1.default.githubRepo,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -2213,7 +2219,10 @@ class CloudRunnerState {
|
||||||
return `https://${CloudRunnerState.buildParams.githubToken}@github.com/game-ci/unity-builder.git`;
|
return `https://${CloudRunnerState.buildParams.githubToken}@github.com/game-ci/unity-builder.git`;
|
||||||
}
|
}
|
||||||
static get targetBuildRepoUrl() {
|
static get targetBuildRepoUrl() {
|
||||||
return `https://${CloudRunnerState.buildParams.githubToken}@github.com/${process.env.GITHUB_REPOSITORY}.git`;
|
return `https://${CloudRunnerState.buildParams.githubToken}@github.com/${CloudRunnerState.githubRepo}.git`;
|
||||||
|
}
|
||||||
|
static get githubRepo() {
|
||||||
|
return `${CloudRunnerState.buildParams.githubRepo}`;
|
||||||
}
|
}
|
||||||
static readBuildEnvironmentVariables() {
|
static readBuildEnvironmentVariables() {
|
||||||
return [
|
return [
|
||||||
|
|
@ -3155,6 +3164,12 @@ class Input {
|
||||||
? process.env[query]
|
? process.env[query]
|
||||||
: false;
|
: false;
|
||||||
}
|
}
|
||||||
|
static get region() {
|
||||||
|
return Input.getInput('region') || 'no region set';
|
||||||
|
}
|
||||||
|
static get githubRepo() {
|
||||||
|
return Input.getInput('GITHUB_REPOSITORY') || 'game-ci/unity-builder';
|
||||||
|
}
|
||||||
static get branch() {
|
static get branch() {
|
||||||
if (Input.getInput(`REMOTE_BUILDER_CACHE`)) {
|
if (Input.getInput(`REMOTE_BUILDER_CACHE`)) {
|
||||||
return Input.getInput(`REMOTE_BUILDER_CACHE`);
|
return Input.getInput(`REMOTE_BUILDER_CACHE`);
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
11
src/index.ts
11
src/index.ts
|
|
@ -47,10 +47,15 @@ async function runRemoteCli(options) {
|
||||||
|
|
||||||
const program = new Command();
|
const program = new Command();
|
||||||
program.version('0.0.1');
|
program.version('0.0.1');
|
||||||
|
const properties = Object.getOwnPropertyNames(Input);
|
||||||
|
core.info(`\n`);
|
||||||
|
core.info(`INPUT:`);
|
||||||
|
for (const element of properties) {
|
||||||
|
program.option(`--${element} <${element}>`, 'default description');
|
||||||
|
core.info(element);
|
||||||
|
}
|
||||||
|
core.info(`\n`);
|
||||||
program.option('-m, --mode <mode>', 'cli or default');
|
program.option('-m, --mode <mode>', 'cli or default');
|
||||||
program.option('-region, --region <region>', 'aws region');
|
|
||||||
program.option('-b, --branch <branch>', 'unity builder branch to clone');
|
|
||||||
program.option('-sN, --awsBaseStackName <awsBaseStackName>', 'aws stack name');
|
|
||||||
program.parse(process.argv);
|
program.parse(process.argv);
|
||||||
|
|
||||||
const options = program.opts();
|
const options = program.opts();
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ class BuildParameters {
|
||||||
public customBuildSteps;
|
public customBuildSteps;
|
||||||
public runNumber;
|
public runNumber;
|
||||||
public branch;
|
public branch;
|
||||||
|
public githubRepo;
|
||||||
|
|
||||||
static async create(): Promise<BuildParameters> {
|
static async create(): Promise<BuildParameters> {
|
||||||
const buildFile = this.parseBuildFile(Input.buildName, Input.targetPlatform, Input.androidAppBundle);
|
const buildFile = this.parseBuildFile(Input.buildName, Input.targetPlatform, Input.androidAppBundle);
|
||||||
|
|
@ -81,6 +82,7 @@ class BuildParameters {
|
||||||
customBuildSteps: Input.customBuildSteps,
|
customBuildSteps: Input.customBuildSteps,
|
||||||
runNumber: Input.runNumber,
|
runNumber: Input.runNumber,
|
||||||
branch: Input.branch,
|
branch: Input.branch,
|
||||||
|
githubRepo: Input.githubRepo,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,11 @@ export class CloudRunnerState {
|
||||||
return `https://${CloudRunnerState.buildParams.githubToken}@github.com/game-ci/unity-builder.git`;
|
return `https://${CloudRunnerState.buildParams.githubToken}@github.com/game-ci/unity-builder.git`;
|
||||||
}
|
}
|
||||||
public static get targetBuildRepoUrl(): string {
|
public static get targetBuildRepoUrl(): string {
|
||||||
return `https://${CloudRunnerState.buildParams.githubToken}@github.com/${process.env.GITHUB_REPOSITORY}.git`;
|
return `https://${CloudRunnerState.buildParams.githubToken}@github.com/${CloudRunnerState.githubRepo}.git`;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static get githubRepo(): string {
|
||||||
|
return `${CloudRunnerState.buildParams.githubRepo}`;
|
||||||
}
|
}
|
||||||
public static readonly defaultGitShaEnvironmentVariable = [
|
public static readonly defaultGitShaEnvironmentVariable = [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,6 @@ const core = require('@actions/core');
|
||||||
class Input {
|
class Input {
|
||||||
public static githubEnabled = true;
|
public static githubEnabled = true;
|
||||||
public static cliOptions;
|
public static cliOptions;
|
||||||
static awsRegion: any;
|
|
||||||
|
|
||||||
private static getInput(query) {
|
private static getInput(query) {
|
||||||
return Input.githubEnabled
|
return Input.githubEnabled
|
||||||
? core.getInput(query)
|
? core.getInput(query)
|
||||||
|
|
@ -21,6 +19,12 @@ class Input {
|
||||||
? process.env[query]
|
? process.env[query]
|
||||||
: false;
|
: false;
|
||||||
}
|
}
|
||||||
|
static get region(): string {
|
||||||
|
return Input.getInput('region') || 'no region set';
|
||||||
|
}
|
||||||
|
static get githubRepo(): string {
|
||||||
|
return Input.getInput('GITHUB_REPOSITORY') || 'game-ci/unity-builder';
|
||||||
|
}
|
||||||
static get branch() {
|
static get branch() {
|
||||||
if (Input.getInput(`REMOTE_BUILDER_CACHE`)) {
|
if (Input.getInput(`REMOTE_BUILDER_CACHE`)) {
|
||||||
return Input.getInput(`REMOTE_BUILDER_CACHE`);
|
return Input.getInput(`REMOTE_BUILDER_CACHE`);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue