mirror of
https://github.com/actions/setup-go.git
synced 2025-07-27 00:48:27 +02:00
Add support for major release selection
This commit adds 'latest' version alias that resolves to the latest available release. The getPossibleVersions function filters available releases using startsWith(version), so calling getLatestVersion(version) with an empty string will return the latest release. Closes #31
This commit is contained in:
parent
9fbc767707
commit
dcc74252e8
2 changed files with 17 additions and 1 deletions
|
@ -167,6 +167,10 @@ function normalizeVersion(version: string): string {
|
|||
}
|
||||
|
||||
async function determineVersion(version: string): Promise<string> {
|
||||
if (version == 'latest') {
|
||||
return await getLatestVersion('');
|
||||
}
|
||||
|
||||
if (!version.endsWith('.x')) {
|
||||
const versionPart = version.split('.');
|
||||
|
||||
|
@ -188,7 +192,7 @@ async function getLatestVersion(version: string): Promise<string> {
|
|||
|
||||
core.debug(`evaluating ${versions.length} versions`);
|
||||
|
||||
if (version.length === 0) {
|
||||
if (versions.length === 0) {
|
||||
throw new Error('unable to get latest version');
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue