Skip to content

Commit

Permalink
Don't preprend v when elixir version does not start with digits (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
starbelly authored Jul 20, 2021
1 parent 9283f85 commit ade4f1d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ jobs:
- elixir-version: '1.10.3'
otp-version: '22.3.4.1'
os: 'ubuntu-20.04'
- elixir-version: 'master'
otp-version: '23.1'
os: 'ubuntu-20.04'
steps:
- uses: actions/checkout@v2
- name: Use erlef/setup-beam
Expand Down
8 changes: 8 additions & 0 deletions __tests__/setup-beam.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,14 @@ async function testElixirVersions() {
got = await setupBeam.getElixirVersion(spec, otpVersion)
assert.deepStrictEqual(got, expected)
simulateInput('version-type', 'loose')

simulateInput('version-type', 'strict')
spec = 'master'
otpVersion = '23.1'
expected = 'master-otp-23'
got = await setupBeam.getElixirVersion(spec, otpVersion)
assert.deepStrictEqual(got, expected)
simulateInput('version-type', 'loose')
}

async function testRebar3Versions() {
Expand Down
5 changes: 4 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4830,7 +4830,10 @@ async function getElixirVersion(exSpec0, otpVersion) {
)
}

return `v${elixirVersionWithOTP}`
const DigitStart = new RegExp('^\\d+')
return DigitStart.test(elixirVersion)
? `v${elixirVersionWithOTP}`
: elixirVersionWithOTP
}

async function getRebar3Version(r3Spec) {
Expand Down
5 changes: 4 additions & 1 deletion src/setup-beam.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ async function getElixirVersion(exSpec0, otpVersion) {
)
}

return `v${elixirVersionWithOTP}`
const DigitStart = new RegExp('^\\d+')
return DigitStart.test(elixirVersion)
? `v${elixirVersionWithOTP}`
: elixirVersionWithOTP
}

async function getRebar3Version(r3Spec) {
Expand Down

0 comments on commit ade4f1d

Please sign in to comment.