Unverified Commit 0e408024 authored by Konrad Pabjan's avatar Konrad Pabjan Committed by GitHub
Browse files

Merge pull request #35 from foo-actions/master

Add more robust support for EA version specification
parents d8ada524 ae687a76
Loading
Loading
Loading
Loading

File changed.

Preview suppressed by a .gitattributes entry or the file's encoding is unsupported.

+11 −2
Changes for src/installer.ts: 11 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -266,8 +266,17 @@ function normalizeVersion(version: string): string {
    }
  }

  // Add trailing .x if it is missing
  if (version.split('.').length != 3) {
  if (version.endsWith('-ea')) {
    // convert e.g. 14-ea to 14.0.0-ea
    if (version.indexOf('.') == -1) {
      version = version.slice(0, version.length - 3) + '.0.0-ea';
    }
    // match anything in -ea.X (semver won't do .x matching on pre-release versions) 
    if (version[0] >= '0' && version[0] <= '9') {
      version = '>=' + version;
    }
  } else if (version.split('.').length < 3) {
    // For non-ea versions, add trailing .x if it is missing
    if (version[version.length - 1] != 'x') {
      version = version + '.x';
    }