Files
unity-builder/src/model/action.ts
Paul Pacheco b72639aac0 perf: avoid building docker image (#365)
* avoid building a custom image

* fix: remove unnecessary double-dash

* Rebuild with -- fix

* linting

* Remove unused variable

* support windows as well

* Fix -- command not found

* Fix unused import, remove docker build test

* no dockerfile anymore

Co-authored-by: Webber Takken <webber.nl@gmail.com>
2022-03-31 01:16:30 +02:00

45 lines
975 B
TypeScript

import path from 'path';
class Action {
static get supportedPlatforms() {
return ['linux', 'win32', 'darwin'];
}
static get isRunningLocally() {
return process.env.RUNNER_WORKSPACE === undefined;
}
static get isRunningFromSource() {
return path.basename(__dirname) === 'model';
}
static get canonicalName() {
return 'unity-builder';
}
static get rootFolder() {
if (Action.isRunningFromSource) {
return path.dirname(path.dirname(path.dirname(__filename)));
}
return path.dirname(path.dirname(__filename));
}
static get actionFolder() {
return `${Action.rootFolder}/dist`;
}
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;