mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-06-06 22:20:16 -07:00
Compare commits
3 Commits
chore/depe
...
chore/remo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
50ea73aec7 | ||
|
|
9dbe552c39 | ||
|
|
2240bedf08 |
@@ -195,5 +195,5 @@ branding:
|
|||||||
icon: 'box'
|
icon: 'box'
|
||||||
color: 'gray-dark'
|
color: 'gray-dark'
|
||||||
runs:
|
runs:
|
||||||
using: 'node20'
|
using: 'node24'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
|||||||
13
package.json
13
package.json
@@ -32,19 +32,16 @@
|
|||||||
"node": ">=18.x"
|
"node": ">=18.x"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^4.1.0",
|
"@actions/cache": "^4.0.0",
|
||||||
"@actions/core": "^1.11.1",
|
"@actions/core": "^1.11.1",
|
||||||
"@actions/exec": "^1.1.1",
|
"@actions/exec": "^1.1.1",
|
||||||
"@actions/github": "^6.0.1",
|
"@actions/github": "^6.0.0",
|
||||||
"commander": "^9.5.0",
|
|
||||||
"commander-ts": "^0.2.0",
|
|
||||||
"md5": "^2.3.0",
|
"md5": "^2.3.0",
|
||||||
"nanoid": "^3.3.12",
|
"nanoid": "^3.3.1",
|
||||||
"reflect-metadata": "^0.2.2",
|
"semver": "^7.5.2",
|
||||||
"semver": "^7.7.4",
|
|
||||||
"ts-md5": "^1.3.1",
|
"ts-md5": "^1.3.1",
|
||||||
"unity-changeset": "^3.1.0",
|
"unity-changeset": "^3.1.0",
|
||||||
"yaml": "^2.8.4"
|
"yaml": "^2.2.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^17.0.23",
|
"@types/node": "^17.0.23",
|
||||||
|
|||||||
@@ -66,12 +66,6 @@ vi.mock('./model', () => ({
|
|||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
vi.mock('./model/cli/cli', () => ({
|
|
||||||
Cli: {
|
|
||||||
InitCliMode: vi.fn().mockReturnValue(false),
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
vi.mock('./model/mac-builder', () => ({
|
vi.mock('./model/mac-builder', () => ({
|
||||||
__esModule: true,
|
__esModule: true,
|
||||||
default: {
|
default: {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import { Action, BuildParameters, Cache, Docker, ImageTag, Output } from './model';
|
import { Action, BuildParameters, Cache, Docker, ImageTag, Output } from './model';
|
||||||
import { Cli } from './model/cli/cli';
|
|
||||||
import MacBuilder from './model/mac-builder';
|
import MacBuilder from './model/mac-builder';
|
||||||
import PlatformSetup from './model/platform-setup';
|
import PlatformSetup from './model/platform-setup';
|
||||||
import { Plugin, loadPlugin } from './model/plugin';
|
import { Plugin, loadPlugin } from './model/plugin';
|
||||||
@@ -9,11 +8,6 @@ import { Plugin, loadPlugin } from './model/plugin';
|
|||||||
// vitest's module re-loading (which changed in vitest 4).
|
// vitest's module re-loading (which changed in vitest 4).
|
||||||
export async function runMain() {
|
export async function runMain() {
|
||||||
try {
|
try {
|
||||||
if (Cli.InitCliMode()) {
|
|
||||||
await Cli.RunCli();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Action.checkCompatibility();
|
Action.checkCompatibility();
|
||||||
Cache.verify();
|
Cache.verify();
|
||||||
|
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
export class CliFunctionsRepository {
|
|
||||||
private static targets: any[] = [];
|
|
||||||
public static PushCliFunction(
|
|
||||||
target: any,
|
|
||||||
propertyKey: string,
|
|
||||||
descriptor: PropertyDescriptor,
|
|
||||||
key: string,
|
|
||||||
description: string,
|
|
||||||
) {
|
|
||||||
CliFunctionsRepository.targets.push({
|
|
||||||
target,
|
|
||||||
propertyKey,
|
|
||||||
descriptor,
|
|
||||||
key,
|
|
||||||
description,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GetCliFunctions(key: any) {
|
|
||||||
const results = CliFunctionsRepository.targets.find((x) => x.key === key);
|
|
||||||
if (results === undefined || results.length === 0) {
|
|
||||||
throw new Error(`no CLI mode found for ${key}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GetAllCliModes() {
|
|
||||||
return CliFunctionsRepository.targets.map((x) => {
|
|
||||||
return {
|
|
||||||
key: x.key,
|
|
||||||
description: x.description,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
|
||||||
public static PushCliFunctionSource(cliFunction: any) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function CliFunction(key: string, description: string) {
|
|
||||||
return (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {
|
|
||||||
CliFunctionsRepository.PushCliFunction(target, propertyKey, descriptor, key, description);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,13 +1,5 @@
|
|||||||
import { Command } from 'commander-ts';
|
|
||||||
import { Input } from '..';
|
|
||||||
import * as core from '@actions/core';
|
|
||||||
import { ActionYamlReader } from '../input-readers/action-yaml';
|
|
||||||
import { CliFunction, CliFunctionsRepository } from './cli-functions-repository';
|
|
||||||
import { OptionValues } from 'commander';
|
|
||||||
import { InputKey } from '../input';
|
|
||||||
|
|
||||||
export class Cli {
|
export class Cli {
|
||||||
public static options: OptionValues | undefined;
|
public static options: Record<string, any> | undefined;
|
||||||
static get isCliMode() {
|
static get isCliMode() {
|
||||||
return Cli.options !== undefined && Cli.options.mode !== undefined && Cli.options.mode !== '';
|
return Cli.options !== undefined && Cli.options.mode !== undefined && Cli.options.mode !== '';
|
||||||
}
|
}
|
||||||
@@ -21,80 +13,4 @@ export class Cli {
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static InitCliMode() {
|
|
||||||
const program = new Command();
|
|
||||||
program.version('0.0.1');
|
|
||||||
|
|
||||||
const actionYamlReader: ActionYamlReader = new ActionYamlReader();
|
|
||||||
const properties = Object.getOwnPropertyNames(Input).filter(
|
|
||||||
(p) => p !== 'length' && p !== 'prototype' && p !== 'name',
|
|
||||||
);
|
|
||||||
for (const element of properties) {
|
|
||||||
program.option(`--${element} <${element}>`, actionYamlReader.GetActionYamlValue(element));
|
|
||||||
}
|
|
||||||
program.option(
|
|
||||||
'-m, --mode <mode>',
|
|
||||||
CliFunctionsRepository.GetAllCliModes()
|
|
||||||
.map((x) => `${x.key} (${x.description})`)
|
|
||||||
.join(` | `),
|
|
||||||
);
|
|
||||||
program.option(
|
|
||||||
'--populateOverride <populateOverride>',
|
|
||||||
'should use override query to pull input false by default',
|
|
||||||
);
|
|
||||||
program.option('--cachePushFrom <cachePushFrom>', 'cache push from source folder');
|
|
||||||
program.option('--cachePushTo <cachePushTo>', 'cache push to caching folder');
|
|
||||||
program.option('--artifactName <artifactName>', 'caching artifact name');
|
|
||||||
program.option('--select <select>', 'select a particular resource');
|
|
||||||
program.option('--logFile <logFile>', 'output to log file (log stream only)');
|
|
||||||
program.option('--profilePath <profilePath>', 'path to submodule profile YAML');
|
|
||||||
program.option('--variantPath <variantPath>', 'path to submodule variant YAML');
|
|
||||||
program.option('--agentPath <agentPath>', 'path to custom LFS transfer agent');
|
|
||||||
program.option('--agentArgs <agentArgs>', 'arguments for custom LFS transfer agent');
|
|
||||||
program.option(
|
|
||||||
'--storagePaths <storagePaths>',
|
|
||||||
'semicolon-separated storage paths for LFS agent',
|
|
||||||
);
|
|
||||||
program.parse(process.argv);
|
|
||||||
Cli.options = program.opts();
|
|
||||||
|
|
||||||
return Cli.isCliMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
static async RunCli(): Promise<void> {
|
|
||||||
const results = CliFunctionsRepository.GetCliFunctions(Cli.options?.mode);
|
|
||||||
if (!results) {
|
|
||||||
throw new Error(
|
|
||||||
`Unknown CLI mode: ${Cli.options?.mode}. Orchestrator CLI features require @game-ci/orchestrator.`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
core.info(`Entrypoint: ${results.key}`);
|
|
||||||
Cli.options!.versioning = 'None';
|
|
||||||
|
|
||||||
return await results.target[results.propertyKey](Cli.options);
|
|
||||||
}
|
|
||||||
|
|
||||||
@CliFunction(`print-input`, `prints all input`)
|
|
||||||
private static logInput() {
|
|
||||||
core.info(`\n`);
|
|
||||||
core.info(`INPUT:`);
|
|
||||||
const properties = Object.getOwnPropertyNames(Input).filter(
|
|
||||||
(p) => p !== 'length' && p !== 'prototype' && p !== 'name',
|
|
||||||
);
|
|
||||||
for (const element of properties) {
|
|
||||||
if (
|
|
||||||
element in Input &&
|
|
||||||
Input[element as InputKey] !== undefined &&
|
|
||||||
Input[element as InputKey] !== '' &&
|
|
||||||
typeof Input[element as InputKey] !== `function` &&
|
|
||||||
element !== 'length' &&
|
|
||||||
element !== 'cliOptions' &&
|
|
||||||
element !== 'prototype'
|
|
||||||
) {
|
|
||||||
core.info(`${element} ${Input[element as InputKey]}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
core.info(`\n`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
46
yarn.lock
46
yarn.lock
@@ -5,7 +5,7 @@ __metadata:
|
|||||||
version: 9
|
version: 9
|
||||||
cacheKey: 10
|
cacheKey: 10
|
||||||
|
|
||||||
"@actions/cache@npm:^4.1.0":
|
"@actions/cache@npm:^4.0.0":
|
||||||
version: 4.1.0
|
version: 4.1.0
|
||||||
resolution: "@actions/cache@npm:4.1.0"
|
resolution: "@actions/cache@npm:4.1.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -42,7 +42,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@actions/github@npm:^6.0.1":
|
"@actions/github@npm:^6.0.0":
|
||||||
version: 6.0.1
|
version: 6.0.1
|
||||||
resolution: "@actions/github@npm:6.0.1"
|
resolution: "@actions/github@npm:6.0.1"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -2302,17 +2302,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"commander-ts@npm:^0.2.0":
|
|
||||||
version: 0.2.0
|
|
||||||
resolution: "commander-ts@npm:0.2.0"
|
|
||||||
dependencies:
|
|
||||||
commander: "npm:^7.2.0"
|
|
||||||
peerDependencies:
|
|
||||||
reflect-metadata: ^0.1.13
|
|
||||||
checksum: 10/b57582d0eb98e7bce0a05bfe7c44b8ed01a0f77a05358ec9d35ef6406ac6b3031590fa49e1bff58649ae511bb18a576b01151cb94de9c12c7f0be7f865ca494f
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"commander@npm:^10.0.1":
|
"commander@npm:^10.0.1":
|
||||||
version: 10.0.1
|
version: 10.0.1
|
||||||
resolution: "commander@npm:10.0.1"
|
resolution: "commander@npm:10.0.1"
|
||||||
@@ -2341,13 +2330,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"commander@npm:^9.5.0":
|
|
||||||
version: 9.5.0
|
|
||||||
resolution: "commander@npm:9.5.0"
|
|
||||||
checksum: 10/41c49b3d0f94a1fbeb0463c85b13f15aa15a9e0b4d5e10a49c0a1d58d4489b549d62262b052ae0aa6cfda53299bee487bfe337825df15e342114dde543f82906
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"common-path-prefix@npm:^3.0.0":
|
"common-path-prefix@npm:^3.0.0":
|
||||||
version: 3.0.0
|
version: 3.0.0
|
||||||
resolution: "common-path-prefix@npm:3.0.0"
|
resolution: "common-path-prefix@npm:3.0.0"
|
||||||
@@ -3800,7 +3782,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"nanoid@npm:^3.3.11, nanoid@npm:^3.3.12":
|
"nanoid@npm:^3.3.1, nanoid@npm:^3.3.11":
|
||||||
version: 3.3.12
|
version: 3.3.12
|
||||||
resolution: "nanoid@npm:3.3.12"
|
resolution: "nanoid@npm:3.3.12"
|
||||||
bin:
|
bin:
|
||||||
@@ -4214,13 +4196,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"reflect-metadata@npm:^0.2.2":
|
|
||||||
version: 0.2.2
|
|
||||||
resolution: "reflect-metadata@npm:0.2.2"
|
|
||||||
checksum: 10/1c93f9ac790fea1c852fde80c91b2760420069f4862f28e6fae0c00c6937a56508716b0ed2419ab02869dd488d123c4ab92d062ae84e8739ea7417fae10c4745
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"regexp-tree@npm:^0.1.27":
|
"regexp-tree@npm:^0.1.27":
|
||||||
version: 0.1.27
|
version: 0.1.27
|
||||||
resolution: "regexp-tree@npm:0.1.27"
|
resolution: "regexp-tree@npm:0.1.27"
|
||||||
@@ -4807,17 +4782,15 @@ __metadata:
|
|||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "unity-builder@workspace:."
|
resolution: "unity-builder@workspace:."
|
||||||
dependencies:
|
dependencies:
|
||||||
"@actions/cache": "npm:^4.1.0"
|
"@actions/cache": "npm:^4.0.0"
|
||||||
"@actions/core": "npm:^1.11.1"
|
"@actions/core": "npm:^1.11.1"
|
||||||
"@actions/exec": "npm:^1.1.1"
|
"@actions/exec": "npm:^1.1.1"
|
||||||
"@actions/github": "npm:^6.0.1"
|
"@actions/github": "npm:^6.0.0"
|
||||||
"@types/node": "npm:^17.0.23"
|
"@types/node": "npm:^17.0.23"
|
||||||
"@types/semver": "npm:^7.3.9"
|
"@types/semver": "npm:^7.3.9"
|
||||||
"@typescript/native-preview": "npm:^7.0.0-dev.20260505.1"
|
"@typescript/native-preview": "npm:^7.0.0-dev.20260505.1"
|
||||||
"@vercel/ncc": "npm:^0.36.1"
|
"@vercel/ncc": "npm:^0.36.1"
|
||||||
"@vitest/coverage-istanbul": "npm:^4.1.5"
|
"@vitest/coverage-istanbul": "npm:^4.1.5"
|
||||||
commander: "npm:^9.5.0"
|
|
||||||
commander-ts: "npm:^0.2.0"
|
|
||||||
cross-env: "npm:^7.0.3"
|
cross-env: "npm:^7.0.3"
|
||||||
eslint: "npm:^10.3.0"
|
eslint: "npm:^10.3.0"
|
||||||
eslint-plugin-unicorn: "npm:^64.0.0"
|
eslint-plugin-unicorn: "npm:^64.0.0"
|
||||||
@@ -4825,19 +4798,18 @@ __metadata:
|
|||||||
js-yaml: "npm:^4.1.0"
|
js-yaml: "npm:^4.1.0"
|
||||||
lint-staged: "npm:^16.4.0"
|
lint-staged: "npm:^16.4.0"
|
||||||
md5: "npm:^2.3.0"
|
md5: "npm:^2.3.0"
|
||||||
nanoid: "npm:^3.3.12"
|
nanoid: "npm:^3.3.1"
|
||||||
node-fetch: "npm:2"
|
node-fetch: "npm:2"
|
||||||
oxfmt: "npm:^0.48.0"
|
oxfmt: "npm:^0.48.0"
|
||||||
oxlint: "npm:^1.63.0"
|
oxlint: "npm:^1.63.0"
|
||||||
reflect-metadata: "npm:^0.2.2"
|
semver: "npm:^7.5.2"
|
||||||
semver: "npm:^7.7.4"
|
|
||||||
ts-md5: "npm:^1.3.1"
|
ts-md5: "npm:^1.3.1"
|
||||||
ts-node: "npm:10.8.1"
|
ts-node: "npm:10.8.1"
|
||||||
typescript: "npm:4.7.4"
|
typescript: "npm:4.7.4"
|
||||||
unity-changeset: "npm:^3.1.0"
|
unity-changeset: "npm:^3.1.0"
|
||||||
vite: "npm:^7"
|
vite: "npm:^7"
|
||||||
vitest: "npm:^4"
|
vitest: "npm:^4"
|
||||||
yaml: "npm:^2.8.4"
|
yaml: "npm:^2.2.2"
|
||||||
yarn-audit-fix: "npm:^9.3.8"
|
yarn-audit-fix: "npm:^9.3.8"
|
||||||
dependenciesMeta:
|
dependenciesMeta:
|
||||||
lefthook:
|
lefthook:
|
||||||
@@ -5209,7 +5181,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"yaml@npm:^2.8.2, yaml@npm:^2.8.4":
|
"yaml@npm:^2.2.2, yaml@npm:^2.8.2":
|
||||||
version: 2.8.4
|
version: 2.8.4
|
||||||
resolution: "yaml@npm:2.8.4"
|
resolution: "yaml@npm:2.8.4"
|
||||||
bin:
|
bin:
|
||||||
|
|||||||
Reference in New Issue
Block a user