Add prototype action using exec and curl

* Downloads a fixed version Julia binary using curl
* Adds it to PATH
* Runs `julia --version` to test the installation
This commit is contained in:
Sascha Mann
2019-08-13 01:13:12 +02:00
parent d3bf4c48c9
commit 7961e4e3f2
8 changed files with 102 additions and 30 deletions

View File

@@ -1,12 +0,0 @@
import * as core from '@actions/core';
async function run() {
try {
const myInput = core.getInput('myInput');
core.debug(`Hello ${myInput}`);
} catch (error) {
core.setFailed(error.message);
}
}
run();

32
src/setup-julia.ts Normal file
View File

@@ -0,0 +1,32 @@
import * as core from "@actions/core";
import * as exec from "@actions/exec";
import * as os from "os";
async function run() {
try {
const version = core.getInput("version");
core.debug(`selected Julia version: ${version}`);
// Store information about the environment
const osPlat = os.platform();
const osArch = os.arch();
// For now, just download Linux x64 binaries
await exec.exec("curl", [
"-O",
"https://julialang-s3.julialang.org/bin/linux/x64/1.0/julia-1.0.1-linux-x86_64.tar.gz"
]);
await exec.exec("tar xf julia-1.0.1-linux-x86_64.tar.gz");
// Add the downloaded binary to path
core.addPath("julia-1.0.1/bin");
// Test if it worked
await exec.exec("julia", ["--version"]);
} catch (error) {
core.setFailed(error.message);
}
}
run();