mirror of
https://github.com/erlef/setup-beam.git
synced 2026-07-22 22:56:07 +00:00
Add known branch exceptions to version matching (#242)
This commit is contained in:
committed by
GitHub
parent
213ca2eceb
commit
b60baf4753
Vendored
+5
-1
@@ -10224,7 +10224,7 @@ function getVersionFromSpec(spec0, versions0) {
|
|||||||
const rangeMax = semver.maxSatisfying(versions, rangeForMax)
|
const rangeMax = semver.maxSatisfying(versions, rangeForMax)
|
||||||
let version = null
|
let version = null
|
||||||
|
|
||||||
if (isStrictVersion() || isRC(spec0)) {
|
if (isStrictVersion() || isRC(spec0) || isKnownBranch(spec0)) {
|
||||||
if (versions0[spec]) {
|
if (versions0[spec]) {
|
||||||
// If `version-type: strict` or version is RC, we obtain it directly
|
// If `version-type: strict` or version is RC, we obtain it directly
|
||||||
version = versions0[spec]
|
version = versions0[spec]
|
||||||
@@ -10296,6 +10296,10 @@ function isRC(ver) {
|
|||||||
return ver.match(xyzAbcVersion('^', '(?:-rc\\.?\\d+)'))
|
return ver.match(xyzAbcVersion('^', '(?:-rc\\.?\\d+)'))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isKnownBranch(ver) {
|
||||||
|
return ['main', 'master', 'maint'].includes(ver)
|
||||||
|
}
|
||||||
|
|
||||||
function getRunnerOSVersion() {
|
function getRunnerOSVersion() {
|
||||||
const ImageOSToContainer = {
|
const ImageOSToContainer = {
|
||||||
ubuntu18: 'ubuntu-18.04',
|
ubuntu18: 'ubuntu-18.04',
|
||||||
|
|||||||
+5
-1
@@ -404,7 +404,7 @@ function getVersionFromSpec(spec0, versions0) {
|
|||||||
const rangeMax = semver.maxSatisfying(versions, rangeForMax)
|
const rangeMax = semver.maxSatisfying(versions, rangeForMax)
|
||||||
let version = null
|
let version = null
|
||||||
|
|
||||||
if (isStrictVersion() || isRC(spec0)) {
|
if (isStrictVersion() || isRC(spec0) || isKnownBranch(spec0)) {
|
||||||
if (versions0[spec]) {
|
if (versions0[spec]) {
|
||||||
// If `version-type: strict` or version is RC, we obtain it directly
|
// If `version-type: strict` or version is RC, we obtain it directly
|
||||||
version = versions0[spec]
|
version = versions0[spec]
|
||||||
@@ -476,6 +476,10 @@ function isRC(ver) {
|
|||||||
return ver.match(xyzAbcVersion('^', '(?:-rc\\.?\\d+)'))
|
return ver.match(xyzAbcVersion('^', '(?:-rc\\.?\\d+)'))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isKnownBranch(ver) {
|
||||||
|
return ['main', 'master', 'maint'].includes(ver)
|
||||||
|
}
|
||||||
|
|
||||||
function getRunnerOSVersion() {
|
function getRunnerOSVersion() {
|
||||||
const ImageOSToContainer = {
|
const ImageOSToContainer = {
|
||||||
ubuntu18: 'ubuntu-18.04',
|
ubuntu18: 'ubuntu-18.04',
|
||||||
|
|||||||
@@ -182,6 +182,18 @@ async function testOTPVersions() {
|
|||||||
expected = 'OTP-20.0.5'
|
expected = 'OTP-20.0.5'
|
||||||
got = await setupBeam.getOTPVersion(spec, osVersion)
|
got = await setupBeam.getOTPVersion(spec, osVersion)
|
||||||
assert.deepStrictEqual(got, expected)
|
assert.deepStrictEqual(got, expected)
|
||||||
|
|
||||||
|
spec = 'maint'
|
||||||
|
osVersion = 'ubuntu-22.04'
|
||||||
|
expected = 'maint'
|
||||||
|
got = await setupBeam.getOTPVersion(spec, osVersion, hexMirrors)
|
||||||
|
assert.deepStrictEqual(got, expected)
|
||||||
|
|
||||||
|
spec = 'master'
|
||||||
|
osVersion = 'ubuntu-22.04'
|
||||||
|
expected = 'master'
|
||||||
|
got = await setupBeam.getOTPVersion(spec, osVersion, hexMirrors)
|
||||||
|
assert.deepStrictEqual(got, expected)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
|
|||||||
Reference in New Issue
Block a user