Files
setup-elixir/src/installer.js

35 lines
786 B
JavaScript
Raw Normal View History

2019-08-28 00:00:01 -04:00
const {exec} = require('@actions/exec')
const path = require('path')
const semver = require('semver')
module.exports = {installElixir, installOTP}
/**
* Install Elixir.
*
* @param {string} version
2019-11-17 19:30:42 +01:00
* @param {string} otpMajor
2019-08-28 00:00:01 -04:00
*/
2019-11-17 19:30:42 +01:00
async function installElixir(version, otpMajor) {
2019-08-28 00:00:01 -04:00
if (process.platform === 'linux') {
2019-11-17 23:40:55 +01:00
const otpString = otpMajor ? `-otp-${otpMajor}` : ''
await exec(path.join(__dirname, 'install-elixir'), [version, otpString])
2019-08-28 00:00:01 -04:00
}
}
/**
* Install OTP.
*
* @param {string} version
*/
async function installOTP(version, osVersion) {
2019-08-28 00:00:01 -04:00
if (process.platform === 'linux') {
await exec(path.join(__dirname, 'install-otp'), [version, osVersion])
2019-08-28 00:00:01 -04:00
return
}
throw new Error(
'@actions/setup-elixir only supports Ubuntu Linux at this time'
)
}