mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-06-02 06:46:15 -07:00
Introduces a yargs-based CLI entry point (src/cli.ts) distributed as the `game-ci` command. The CLI reuses existing unity-builder modules — Input, BuildParameters, Orchestrator, Docker, MacBuilder — so the same build engine powers both the GitHub Action and the standalone CLI. Commands: build, activate, orchestrate, cache (list/restore/clear), status, version. Closes #812 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import type { CommandModule } from 'yargs';
|
|
import * as core from '@actions/core';
|
|
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
|
|
const versionCommand: CommandModule = {
|
|
command: 'version',
|
|
describe: 'Show version info',
|
|
builder: {},
|
|
handler: async () => {
|
|
try {
|
|
// Read version from package.json
|
|
let packageJsonPath = path.join(__dirname, '..', '..', '..', 'package.json');
|
|
if (!fs.existsSync(packageJsonPath)) {
|
|
packageJsonPath = path.join(__dirname, '..', '..', 'package.json');
|
|
}
|
|
if (!fs.existsSync(packageJsonPath)) {
|
|
packageJsonPath = path.join(process.cwd(), 'package.json');
|
|
}
|
|
|
|
if (fs.existsSync(packageJsonPath)) {
|
|
const packageData = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
core.info(`game-ci (unity-builder) v${packageData.version}`);
|
|
core.info(`Node.js ${process.version}`);
|
|
core.info(`Platform: ${process.platform} ${process.arch}`);
|
|
} else {
|
|
core.info('game-ci (unity-builder)');
|
|
core.info('Version information unavailable');
|
|
}
|
|
} catch (error: any) {
|
|
core.info('game-ci (unity-builder)');
|
|
core.error(`Could not read version: ${error.message}`);
|
|
}
|
|
},
|
|
};
|
|
|
|
export default versionCommand;
|