mirror of
https://github.com/game-ci/unity-activate
synced 2026-02-04 10:19:14 +08:00
Upgrade to use typescript instead of javascript and use game-ci images
* Upgrade to using typescript instead of javascript and use game-ci images instead of gableroux images * Fix errors * Update bash script * Fix test * Remove test * Add versioning * Update husky * Update husky * Update husky * Update package.json * Update husky and image-tag * Use 'yarn lint-staged' instead of 'npx lint-staged' * Update entrypoint.sh
This commit is contained in:
48
src/model/action.ts
Normal file
48
src/model/action.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import path from 'path';
|
||||
|
||||
const Action = {
|
||||
get supportedPlatforms() {
|
||||
return ['linux'];
|
||||
},
|
||||
|
||||
get isRunningLocally() {
|
||||
return process.env.RUNNER_WORKSPACE === undefined;
|
||||
},
|
||||
|
||||
get isRunningFromSource() {
|
||||
return path.basename(__dirname) === 'model';
|
||||
},
|
||||
|
||||
get canonicalName() {
|
||||
return 'unity-activate';
|
||||
},
|
||||
|
||||
get rootFolder() {
|
||||
if (Action.isRunningFromSource) {
|
||||
return path.dirname(path.dirname(path.dirname(__filename)));
|
||||
}
|
||||
|
||||
return path.dirname(path.dirname(__filename));
|
||||
},
|
||||
|
||||
get actionFolder() {
|
||||
return `${Action.rootFolder}/dist`;
|
||||
},
|
||||
|
||||
get dockerfile() {
|
||||
return `${Action.actionFolder}/Dockerfile`;
|
||||
},
|
||||
|
||||
get workspace() {
|
||||
return process.env.GITHUB_WORKSPACE;
|
||||
},
|
||||
|
||||
checkCompatibility() {
|
||||
const currentPlatform = process.platform;
|
||||
if (!Action.supportedPlatforms.includes(currentPlatform)) {
|
||||
throw new Error(`Currently ${currentPlatform}-platform is not supported`);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default Action;
|
||||
Reference in New Issue
Block a user