neiam /action-setup-beam
action-setup-beam
public · Issues · Pulls · Labels · Forks · Compare · Actions queued
⭐
Log in to mark this repository.
Add known branch exceptions to version matching (#242)
b60baf4 · Paulo F. Oliveira · 2024-01-17 23:37
Files changed
modified
dist/index.js
+5
−1
@@ -10224,7 +10224,7 @@ function getVersionFromSpec(spec0, versions0) {
| 10224 | 10224 | const rangeMax = semver.maxSatisfying(versions, rangeForMax) |
| 10225 | 10225 | let version = null |
| 10226 | 10226 | |
| 10227 | − if (isStrictVersion() || isRC(spec0)) { | |
| 10227 | + if (isStrictVersion() || isRC(spec0) || isKnownBranch(spec0)) { | |
| 10228 | 10228 | if (versions0[spec]) { |
| 10229 | 10229 | // If `version-type: strict` or version is RC, we obtain it directly |
| 10230 | 10230 | version = versions0[spec] |
@@ -10296,6 +10296,10 @@ function isRC(ver) {
| 10296 | 10296 | return ver.match(xyzAbcVersion('^', '(?:-rc\\.?\\d+)')) |
| 10297 | 10297 | } |
| 10298 | 10298 | |
| 10299 | +function isKnownBranch(ver) { | |
| 10300 | + return ['main', 'master', 'maint'].includes(ver) | |
| 10301 | +} | |
| 10302 | + | |
| 10299 | 10303 | function getRunnerOSVersion() { |
| 10300 | 10304 | const ImageOSToContainer = { |
| 10301 | 10305 | ubuntu18: 'ubuntu-18.04', |
modified
src/setup-beam.js
+5
−1
@@ -404,7 +404,7 @@ function getVersionFromSpec(spec0, versions0) {
| 404 | 404 | const rangeMax = semver.maxSatisfying(versions, rangeForMax) |
| 405 | 405 | let version = null |
| 406 | 406 | |
| 407 | − if (isStrictVersion() || isRC(spec0)) { | |
| 407 | + if (isStrictVersion() || isRC(spec0) || isKnownBranch(spec0)) { | |
| 408 | 408 | if (versions0[spec]) { |
| 409 | 409 | // If `version-type: strict` or version is RC, we obtain it directly |
| 410 | 410 | version = versions0[spec] |
@@ -476,6 +476,10 @@ function isRC(ver) {
| 476 | 476 | return ver.match(xyzAbcVersion('^', '(?:-rc\\.?\\d+)')) |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | +function isKnownBranch(ver) { | |
| 480 | + return ['main', 'master', 'maint'].includes(ver) | |
| 481 | +} | |
| 482 | + | |
| 479 | 483 | function getRunnerOSVersion() { |
| 480 | 484 | const ImageOSToContainer = { |
| 481 | 485 | ubuntu18: 'ubuntu-18.04', |
modified
test/setup-beam.test.js
+12
−0
@@ -182,6 +182,18 @@ async function testOTPVersions() {
| 182 | 182 | expected = 'OTP-20.0.5' |
| 183 | 183 | got = await setupBeam.getOTPVersion(spec, osVersion) |
| 184 | 184 | assert.deepStrictEqual(got, expected) |
| 185 | + | |
| 186 | + spec = 'maint' | |
| 187 | + osVersion = 'ubuntu-22.04' | |
| 188 | + expected = 'maint' | |
| 189 | + got = await setupBeam.getOTPVersion(spec, osVersion, hexMirrors) | |
| 190 | + assert.deepStrictEqual(got, expected) | |
| 191 | + | |
| 192 | + spec = 'master' | |
| 193 | + osVersion = 'ubuntu-22.04' | |
| 194 | + expected = 'master' | |
| 195 | + got = await setupBeam.getOTPVersion(spec, osVersion, hexMirrors) | |
| 196 | + assert.deepStrictEqual(got, expected) | |
| 185 | 197 | } |
| 186 | 198 | |
| 187 | 199 | if (process.platform === 'win32') { |
Parents: 213ca2e