Initial commit
This commit is contained in:
36
src/installer.js
Normal file
36
src/installer.js
Normal file
@@ -0,0 +1,36 @@
|
||||
const {exec} = require('@actions/exec')
|
||||
const path = require('path')
|
||||
const semver = require('semver')
|
||||
|
||||
module.exports = {installElixir, installOTP}
|
||||
|
||||
/**
|
||||
* Install Elixir.
|
||||
*
|
||||
* @param {string} version
|
||||
* @param {string} arch
|
||||
*/
|
||||
async function installElixir(version) {
|
||||
let arch = 'all'
|
||||
if (semver.gt('1.9.0', version)) arch = 'amd64'
|
||||
|
||||
if (process.platform === 'linux') {
|
||||
await exec(path.join(__dirname, 'install-elixir-ubuntu'), [version, arch])
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Install OTP.
|
||||
*
|
||||
* @param {string} version
|
||||
*/
|
||||
async function installOTP(version) {
|
||||
if (process.platform === 'linux') {
|
||||
await exec(path.join(__dirname, 'install-otp-ubuntu'), [version])
|
||||
return
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
'@actions/setup-elixir only supports Ubuntu Linux at this time'
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user