mirror of
https://github.com/julia-actions/setup-julia.git
synced 2026-02-12 02:56:54 +08:00
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:
12
src/main.ts
12
src/main.ts
@@ -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
32
src/setup-julia.ts
Normal 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();
|
||||
Reference in New Issue
Block a user