2019-09-23 19:56:26 -07:00
|
|
|
import * as core from '@actions/core';
|
2019-09-30 10:01:13 -07:00
|
|
|
import {findHaskellGHCVersion, findHaskellCabalVersion} from './installer';
|
2019-09-23 19:56:26 -07:00
|
|
|
|
2019-09-30 10:01:13 -07:00
|
|
|
// ghc and cabal are installed directly to /opt so use that directlly instead of
|
|
|
|
|
// copying over to the toolcache dir.
|
|
|
|
|
const baseInstallDir = '/opt';
|
2019-09-23 20:32:15 -07:00
|
|
|
const defaultGHCVersion = '8.6.5';
|
2019-09-30 10:01:13 -07:00
|
|
|
const defaultCabalVersion = '3.0';
|
2019-09-23 20:32:15 -07:00
|
|
|
|
2019-09-23 19:56:26 -07:00
|
|
|
async function run() {
|
|
|
|
|
try {
|
|
|
|
|
let ghcVersion = core.getInput('ghc-version');
|
2019-09-23 20:32:15 -07:00
|
|
|
if (!ghcVersion) {
|
|
|
|
|
ghcVersion = defaultGHCVersion;
|
|
|
|
|
}
|
2019-09-30 10:01:13 -07:00
|
|
|
await findHaskellGHCVersion(baseInstallDir, ghcVersion);
|
2019-09-23 20:07:29 -07:00
|
|
|
|
|
|
|
|
let cabalVersion = core.getInput('cabal-version');
|
2019-09-23 20:32:15 -07:00
|
|
|
if (!cabalVersion) {
|
2019-09-30 10:01:13 -07:00
|
|
|
cabalVersion = defaultCabalVersion;
|
2019-09-23 20:32:15 -07:00
|
|
|
}
|
2019-09-30 10:01:13 -07:00
|
|
|
await findHaskellCabalVersion(baseInstallDir, cabalVersion);
|
2019-09-23 19:56:26 -07:00
|
|
|
} catch (error) {
|
|
|
|
|
core.setFailed(error.message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
run();
|