-
Notifications
You must be signed in to change notification settings - Fork 540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle .x version syntax with latest release #13
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution - generally this looks great, just left a couple of comments!
//append patch version if not available | ||
return version.concat('.0'); | ||
} | ||
return version; | ||
} | ||
|
||
async function determineVersion(version: string): Promise<string> { | ||
if (!version.endsWith('.x')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we do something similar to normalizeVersion
here, but instead of appending 0s at the end, append a .x
? What I'm after is, I want people to just be able to specify 1.10
and have that resolve to 1.10.x
, since referring to versions like that is pretty common.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion, I've pushed an update to handle this.
const versions = await getAvailableVersions(); | ||
const possibleVersions = versions.filter(v => v.startsWith(version)); | ||
|
||
const versionMap = new Map(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than creating a map here, can you just do something like return possibleVersions.sort()
(an alphabetic sort which matches the semver versioning ordering). I think what you're doing here is basically just doing that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I am doing here is sorting using semver, which different with regular sort function.
sort
returns:
[ '1.10',
'1.10.1',
'1.10.2',
'1.10.3',
'1.10.4',
'1.10.5',
'1.10.6',
'1.10.7',
'1.10.8',
'1.10beta1',
'1.10beta2',
'1.10rc1',
'1.10rc2' ]
While this returns:
[ '1.10.8',
'1.10.7',
'1.10.6',
'1.10.5',
'1.10.4',
'1.10.3',
'1.10.2',
'1.10.1',
'1.10',
'1.10rc2',
'1.10rc1',
'1.10beta2',
'1.10beta1' ]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh good point, sorry my mistake
This looks great - thanks for doing this! |
This will make sure that it will always test against the latest patch version. actions/setup-go#13
|
||
core.debug(`evaluating ${versions.length} versions`); | ||
|
||
if (version.length === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
versions.length
.
This PR adds the ability to resolve .x version syntax to the latest release, e.g.:
1.10.x
as1.10.8
.This PR is a solution for #11.