Don't preprend v when elixir version does not start with digits (#61)

ade4f1d · Bryan Paxton · 2021-07-20 19:08

9 files +19 -2

Files changed

modified .github/workflows/ubuntu.yml
+3 −0
@@ -103,6 +103,9 @@ jobs:
103 103 - elixir-version: '1.10.3'
104 104 otp-version: '22.3.4.1'
105 105 os: 'ubuntu-20.04'
106 + - elixir-version: 'master'
107 + otp-version: '23.1'
108 + os: 'ubuntu-20.04'
106 109 steps:
107 110 - uses: actions/checkout@v2
108 111 - name: Use erlef/setup-beam
modified __tests__/setup-beam.test.js
+8 −0
@@ -187,6 +187,14 @@ async function testElixirVersions() {
187 187 got = await setupBeam.getElixirVersion(spec, otpVersion)
188 188 assert.deepStrictEqual(got, expected)
189 189 simulateInput('version-type', 'loose')
190 +
191 + simulateInput('version-type', 'strict')
192 + spec = 'master'
193 + otpVersion = '23.1'
194 + expected = 'master-otp-23'
195 + got = await setupBeam.getElixirVersion(spec, otpVersion)
196 + assert.deepStrictEqual(got, expected)
197 + simulateInput('version-type', 'loose')
190 198 }
191 199
192 200 async function testRebar3Versions() {
modified dist/index.js
+4 −1
@@ -4830,7 +4830,10 @@ async function getElixirVersion(exSpec0, otpVersion) {
4830 4830 )
4831 4831 }
4832 4832
4833 return `v${elixirVersionWithOTP}`
4833 + const DigitStart = new RegExp('^\\d+')
4834 + return DigitStart.test(elixirVersion)
4835 + ? `v${elixirVersionWithOTP}`
4836 + : elixirVersionWithOTP
4834 4837 }
4835 4838
4836 4839 async function getRebar3Version(r3Spec) {
modified src/setup-beam.js
+4 −1
@@ -174,7 +174,10 @@ async function getElixirVersion(exSpec0, otpVersion) {
174 174 )
175 175 }
176 176
177 return `v${elixirVersionWithOTP}`
177 + const DigitStart = new RegExp('^\\d+')
178 + return DigitStart.test(elixirVersion)
179 + ? `v${elixirVersionWithOTP}`
180 + : elixirVersionWithOTP
178 181 }
179 182
180 183 async function getRebar3Version(r3Spec) {

Parents: 9283f85