mirror of https://github.com/actions/setup-go.git
Return alias condition to main
This commit is contained in:
parent
a29996aa9d
commit
18c62c8dd3
|
@ -63213,7 +63213,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.parseGoVersionFile = exports.makeSemver = exports.getVersionsDist = exports.findMatch = exports.getInfoFromManifest = exports.getManifest = exports.extractGoArchive = exports.resolveVersionFromManifest = exports.getGo = void 0;
|
||||
exports.resolveStableVersionInput = exports.parseGoVersionFile = exports.makeSemver = exports.getVersionsDist = exports.findMatch = exports.getInfoFromManifest = exports.getManifest = exports.extractGoArchive = exports.resolveVersionFromManifest = exports.getGo = void 0;
|
||||
const tc = __importStar(__nccwpck_require__(7784));
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const path = __importStar(__nccwpck_require__(1017));
|
||||
|
@ -63237,10 +63237,6 @@ function getGo(versionSpec, checkLatest, auth, arch = os_1.default.arch(), manif
|
|||
core.info(`Failed to resolve version ${versionSpec} from manifest`);
|
||||
}
|
||||
}
|
||||
if (versionSpec === utils_1.StableReleaseAlias.Stable ||
|
||||
versionSpec === utils_1.StableReleaseAlias.OldStable) {
|
||||
versionSpec = yield resolveStableVersionInput(versionSpec, auth, arch, manifest);
|
||||
}
|
||||
// check cache
|
||||
let toolPath;
|
||||
toolPath = tc.find('go', versionSpec, arch);
|
||||
|
@ -63490,6 +63486,7 @@ function resolveStableVersionInput(versionSpec, auth, arch = os_1.default.arch()
|
|||
}
|
||||
});
|
||||
}
|
||||
exports.resolveStableVersionInput = resolveStableVersionInput;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
@ -63542,6 +63539,7 @@ const cache_utils_1 = __nccwpck_require__(1678);
|
|||
const child_process_1 = __importDefault(__nccwpck_require__(2081));
|
||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||
const os_1 = __importDefault(__nccwpck_require__(2037));
|
||||
const utils_1 = __nccwpck_require__(1314);
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
|
@ -63549,7 +63547,7 @@ function run() {
|
|||
// versionSpec is optional. If supplied, install / use from the tool cache
|
||||
// If not supplied then problem matchers will still be setup. Useful for self-hosted.
|
||||
//
|
||||
const versionSpec = resolveVersionInput();
|
||||
let versionSpec = resolveVersionInput();
|
||||
const cache = core.getBooleanInput('cache');
|
||||
core.info(`Setup go version spec ${versionSpec}`);
|
||||
let arch = core.getInput('architecture');
|
||||
|
@ -63561,6 +63559,10 @@ function run() {
|
|||
let auth = !token ? undefined : `token ${token}`;
|
||||
const manifest = yield installer.getManifest(auth);
|
||||
const checkLatest = core.getBooleanInput('check-latest');
|
||||
if (versionSpec === utils_1.StableReleaseAlias.Stable ||
|
||||
versionSpec === utils_1.StableReleaseAlias.OldStable) {
|
||||
versionSpec = yield installer.resolveStableVersionInput(versionSpec, auth, arch, manifest);
|
||||
}
|
||||
const installDir = yield installer.getGo(versionSpec, checkLatest, auth, arch, manifest);
|
||||
core.addPath(path_1.default.join(installDir, 'bin'));
|
||||
core.info('Added go to the path');
|
||||
|
|
|
@ -56,18 +56,6 @@ export async function getGo(
|
|||
}
|
||||
}
|
||||
|
||||
if (
|
||||
versionSpec === StableReleaseAlias.Stable ||
|
||||
versionSpec === StableReleaseAlias.OldStable
|
||||
) {
|
||||
versionSpec = await resolveStableVersionInput(
|
||||
versionSpec,
|
||||
auth,
|
||||
arch,
|
||||
manifest
|
||||
);
|
||||
}
|
||||
|
||||
// check cache
|
||||
let toolPath: string;
|
||||
toolPath = tc.find('go', versionSpec, arch);
|
||||
|
@ -354,7 +342,7 @@ export function parseGoVersionFile(versionFilePath: string): string {
|
|||
return contents.trim();
|
||||
}
|
||||
|
||||
async function resolveStableVersionInput(
|
||||
export async function resolveStableVersionInput(
|
||||
versionSpec: string,
|
||||
auth: string | undefined,
|
||||
arch = os.arch(),
|
||||
|
|
15
src/main.ts
15
src/main.ts
|
@ -8,7 +8,6 @@ import {isCacheFeatureAvailable} from './cache-utils';
|
|||
import cp from 'child_process';
|
||||
import fs from 'fs';
|
||||
import os from 'os';
|
||||
import {IToolRelease} from '@actions/tool-cache';
|
||||
import {StableReleaseAlias} from './utils';
|
||||
|
||||
export async function run() {
|
||||
|
@ -17,7 +16,7 @@ export async function run() {
|
|||
// versionSpec is optional. If supplied, install / use from the tool cache
|
||||
// If not supplied then problem matchers will still be setup. Useful for self-hosted.
|
||||
//
|
||||
const versionSpec = resolveVersionInput();
|
||||
let versionSpec = resolveVersionInput();
|
||||
|
||||
const cache = core.getBooleanInput('cache');
|
||||
core.info(`Setup go version spec ${versionSpec}`);
|
||||
|
@ -36,6 +35,18 @@ export async function run() {
|
|||
|
||||
const checkLatest = core.getBooleanInput('check-latest');
|
||||
|
||||
if (
|
||||
versionSpec === StableReleaseAlias.Stable ||
|
||||
versionSpec === StableReleaseAlias.OldStable
|
||||
) {
|
||||
versionSpec = await installer.resolveStableVersionInput(
|
||||
versionSpec,
|
||||
auth,
|
||||
arch,
|
||||
manifest
|
||||
);
|
||||
}
|
||||
|
||||
const installDir = await installer.getGo(
|
||||
versionSpec,
|
||||
checkLatest,
|
||||
|
|
Loading…
Reference in New Issue