mirror of
https://github.com/mtkennerly/dunamai-action.git
synced 2025-06-20 22:31:08 +00:00
Initial commit
This commit is contained in:
commit
67c82a2422
10 changed files with 210 additions and 0 deletions
37
index.js
Normal file
37
index.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
const core = require("@actions/core");
|
||||
const { execSync } = require("child_process");
|
||||
|
||||
function runCommand(command) {
|
||||
console.log(`Running command: ${command}`);
|
||||
return execSync(command);
|
||||
}
|
||||
|
||||
function main() {
|
||||
const install = core.getInput("install");
|
||||
const envVar = core.getInput("env-var");
|
||||
const command = core.getInput("command");
|
||||
const args = core.getInput("args");
|
||||
|
||||
if (dunamaiVersion === "none") {
|
||||
// No install.
|
||||
} else if (dunamaiVersion === "latest") {
|
||||
runCommand("pip install dunamai");
|
||||
} else {
|
||||
runCommand(`pip install dunamai==${dunamaiVersion}`);
|
||||
}
|
||||
|
||||
const version = runCommand(`${command} ${args}`).toString();
|
||||
core.setOutput("version", version);
|
||||
console.log(`Dynamic version: ${version}`);
|
||||
|
||||
if (envVar !== "") {
|
||||
console.log(`Setting environment variable: ${envVar}`);
|
||||
core.exportVariable(envVar, version);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
main();
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue