mirror of
https://github.com/erlef/setup-beam.git
synced 2026-07-23 07:06:07 +00:00
Install OTP branches
This commit is contained in:
Vendored
+19
-15
@@ -3314,9 +3314,10 @@ main().catch(err => {
|
||||
async function main() {
|
||||
checkPlatform()
|
||||
|
||||
const osVersion = getRunnerOSVersion()
|
||||
const otpSpec = core.getInput('otp-version', {required: true})
|
||||
const elixirSpec = core.getInput('elixir-version', {required: true})
|
||||
const otpVersion = await getOtpVersion(otpSpec)
|
||||
const otpVersion = await getOtpVersion(otpSpec, osVersion)
|
||||
const [elixirVersion, otpMajor] = await getElixirVersion(
|
||||
elixirSpec,
|
||||
otpVersion
|
||||
@@ -3328,10 +3329,6 @@ async function main() {
|
||||
let installRebar = core.getInput('install-rebar')
|
||||
installRebar = installRebar == null ? 'true' : installRebar
|
||||
|
||||
const experimentalOTP = core.getInput('experimental-otp')
|
||||
const osVersion =
|
||||
experimentalOTP === 'true' ? getRunnerOSVersion() : 'ubuntu-14.04'
|
||||
|
||||
console.log(`##[group]Installing OTP ${otpVersion} - built on ${osVersion}`)
|
||||
await installOTP(otpVersion, osVersion)
|
||||
console.log(`##[endgroup]`)
|
||||
@@ -3359,11 +3356,12 @@ function checkPlatform() {
|
||||
)
|
||||
}
|
||||
|
||||
async function getOtpVersion(spec) {
|
||||
return getVersionFromSpec(spec, await getOtpVersions()) || spec
|
||||
async function getOtpVersion(spec, osVersion) {
|
||||
const version = getVersionFromSpec(spec, await getOtpVersions(osVersion))
|
||||
return version ? `OTP-${version}` : spec
|
||||
}
|
||||
|
||||
function getRunnerOSVersion(experimentalOTP) {
|
||||
function getRunnerOSVersion() {
|
||||
const mapToUbuntuVersion = {
|
||||
ubuntu16: 'ubuntu-16.04',
|
||||
ubuntu18: 'ubuntu-18.04',
|
||||
@@ -3385,10 +3383,10 @@ async function getElixirVersion(spec, otpVersion) {
|
||||
|
||||
const version = getVersionFromSpec(spec, semverVersions)
|
||||
const gitRef = version ? `v${version}` : spec
|
||||
const [otpMajor] = otpVersion.match(/^\d+/)
|
||||
const otpMatch = otpVersion.match(/^OTP-([\.\d]+)/)
|
||||
|
||||
if (versions.get(gitRef).includes(otpMajor)) {
|
||||
return [gitRef, otpMajor]
|
||||
if (otpMatch != null && versions.get(gitRef).includes(otpMatch[0])) {
|
||||
return [gitRef, otpMatch[0]]
|
||||
} else {
|
||||
return [gitRef, null]
|
||||
}
|
||||
@@ -3403,17 +3401,23 @@ function getVersionFromSpec(spec, versions) {
|
||||
}
|
||||
}
|
||||
|
||||
async function getOtpVersions() {
|
||||
async function getOtpVersions(osVersion) {
|
||||
const result = await get(
|
||||
'https://raw.githubusercontent.com/erlang/otp/master/otp_versions.table'
|
||||
`https://repo.hex.pm/builds/otp/${osVersion}/builds.txt`
|
||||
)
|
||||
|
||||
return result
|
||||
.trim()
|
||||
.split('\n')
|
||||
.map(line => {
|
||||
const [_, version] = line.match(/^OTP-([\.\d]+)/)
|
||||
return version
|
||||
const match = line.match(/^OTP-([\.\d]+)/)
|
||||
|
||||
if (match) {
|
||||
const [_, version] = match
|
||||
return version
|
||||
} else {
|
||||
return line
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user