unity-builder/src/model/action.ts

45 lines
975 B
TypeScript
Raw Normal View History

2019-12-22 14:05:15 +00:00
import path from 'path';
class Action {
2019-12-22 14:05:15 +00:00
static get supportedPlatforms() {
Initial Support for MacOS IL2CPP Builds (#326) * Add intial framework for macos builds. Test install editor * Fix unity hub path space * Single quote space in path * Escape space character * More backslashes * Move to bash scripts for setup * Add path to command args * Different command to run shell script * Use full path to scripts * Unpack changeset value and fix missing escape characters * Print changeset * More debug * Remove debug * Fix script paths * Printenv debug * Write environment variables to file to read in bash script * Debug file write * More debug * Fix missing await * Move back to process.env * Fix path typo * Add missing flags * Make directory for license activation * Add missing sudo * Give permissions to license folder * Fix path issues * Add build tests * Try ts setup again * Try quoting path * Further migrate mac scripts to align with linux scripts * print pwd * Fix changeset and remove unneeded env vars * Ignore return code * fix missing current directory * Fix project path * pwd * Remove project path * Revert to cwd being the workspace folder and pass action folder as an env variable. * Add blank project to use for activation * Add blank project path * Fix build tests * Don't rebuild library on windows * Fix project path windows * Fix platform specific workspace env variable * Fix incorrect variable name * Update .github/workflows/mac-build-tests.yml Co-authored-by: Webber Takken <webber.nl@gmail.com> * Update .github/workflows/mac-build-tests.yml Co-authored-by: Webber Takken <webber.nl@gmail.com> * Update dist/BlankProject/Packages/packages-lock.json Co-authored-by: Webber Takken <webber.nl@gmail.com> * Update src/model/platform-setup/setup-mac.ts Co-authored-by: Webber Takken <webber.nl@gmail.com> * Update src/model/platform-setup/setup-mac.ts Co-authored-by: Webber Takken <webber.nl@gmail.com> * Fix formatting Co-authored-by: Webber Takken <webber.nl@gmail.com>
2022-02-02 09:15:37 +00:00
return ['linux', 'win32', 'darwin'];
2019-12-22 14:05:15 +00:00
}
2019-12-22 17:07:55 +00:00
static get isRunningLocally() {
return process.env.RUNNER_WORKSPACE === undefined;
}
static get isRunningFromSource() {
return path.basename(__dirname) === 'model';
2019-12-22 17:07:55 +00:00
}
static get canonicalName() {
2019-12-22 14:05:15 +00:00
return 'unity-builder';
}
static get rootFolder() {
2019-12-22 17:07:55 +00:00
if (Action.isRunningFromSource) {
return path.dirname(path.dirname(path.dirname(__filename)));
}
return path.dirname(path.dirname(__filename));
2019-12-22 14:05:15 +00:00
}
static get actionFolder() {
return `${Action.rootFolder}/dist`;
2020-01-07 21:26:15 +00:00
}
2019-12-22 14:05:15 +00:00
static get workspace() {
return process.env.GITHUB_WORKSPACE;
}
static checkCompatibility() {
const currentPlatform = process.platform;
if (!Action.supportedPlatforms.includes(currentPlatform)) {
throw new Error(`Currently ${currentPlatform}-platform is not supported`);
}
}
}
export default Action;