@@ -25915,8 +25915,8 @@ async function main() {
2591525915 const rebar3Spec = getInput('rebar3-version', false, 'rebar', versions)
2591625916
2591725917 if (otpSpec !== 'false') {
25918- await installOTP(otpSpec, osVersion)
25919- const elixirInstalled = await maybeInstallElixir(elixirSpec, otpSpec )
25918+ const otpVersion = await installOTP(otpSpec, osVersion)
25919+ const elixirInstalled = await maybeInstallElixir(elixirSpec, otpVersion )
2592025920 if (elixirInstalled === true) {
2592125921 const shouldMixRebar = getInput('install-rebar', false)
2592225922 await mix(shouldMixRebar, 'rebar')
@@ -25958,10 +25958,10 @@ async function installOTP(otpSpec, osVersion) {
2595825958 return otpVersion
2595925959}
2596025960
25961- async function maybeInstallElixir(elixirSpec, otpSpec ) {
25961+ async function maybeInstallElixir(elixirSpec, otpVersion ) {
2596225962 let installed = false
2596325963 if (elixirSpec) {
25964- const elixirVersion = await getElixirVersion(elixirSpec, otpSpec )
25964+ const elixirVersion = await getElixirVersion(elixirSpec, otpVersion )
2596525965 core.startGroup(`Installing Elixir ${elixirVersion}`)
2596625966 await doWithMirrors({
2596725967 hexMirrors: hexMirrorsInput(),
@@ -26067,13 +26067,16 @@ function requestedVersionFor(tool, version, originListing, mirrors) {
2606726067 )
2606826068}
2606926069
26070- const knownBranches = ['main ', 'master ', 'maint ']
26070+ const knownBranches = ['master ', 'maint ', 'main ']
2607126071const nonSpecificVersions = ['nightly', 'latest']
2607226072
2607326073async function getElixirVersion(exSpec0, otpVersion0) {
26074- const otpVersion = otpVersion0.match(/^(?:OTP-)?(.+)$/)[1]
26075- const regex = `^(\\d{1,3}|${knownBranches.join('|')}|${nonSpecificVersions.join('|')})?.*$`
26076- let otpVersionMajor = otpVersion.match(new RegExp(regex))[1]
26074+ let otpVersion = otpVersion0.replace(/-rc.*/, '')
26075+ knownBranches.forEach((branch) => {
26076+ otpVersion = otpVersion.replace(`${branch}-`, '').replace(`${branch}`, '')
26077+ })
26078+ // after this we should have either a number-string of an empty string
26079+ let otpVersionMajor = otpVersion.match(/(\d{1,3}).*/)?.[1] ?? ''
2607726080
2607826081 const otpSuffix = /-otp-(\d+)/
2607926082 const userSuppliedOtp = exSpec0.match(otpSuffix)?.[1] ?? null
0 commit comments