|
|
|
@ -7,6 +7,7 @@ import * as sys from './system';
|
|
|
|
|
import fs from 'fs';
|
|
|
|
|
import os from 'os';
|
|
|
|
|
import {StableReleaseAlias, isSelfHosted} from './utils';
|
|
|
|
|
import {Architecture} from './types';
|
|
|
|
|
|
|
|
|
|
const MANIFEST_REPO_OWNER = 'actions';
|
|
|
|
|
const MANIFEST_REPO_NAME = 'go-versions';
|
|
|
|
@ -39,7 +40,7 @@ export async function getGo(
|
|
|
|
|
versionSpec: string,
|
|
|
|
|
checkLatest: boolean,
|
|
|
|
|
auth: string | undefined,
|
|
|
|
|
arch = os.arch()
|
|
|
|
|
arch: Architecture = os.arch() as Architecture
|
|
|
|
|
) {
|
|
|
|
|
let manifest: tc.IToolRelease[] | undefined;
|
|
|
|
|
const osPlat: string = os.platform();
|
|
|
|
@ -151,7 +152,7 @@ async function resolveVersionFromManifest(
|
|
|
|
|
versionSpec: string,
|
|
|
|
|
stable: boolean,
|
|
|
|
|
auth: string | undefined,
|
|
|
|
|
arch: string,
|
|
|
|
|
arch: Architecture,
|
|
|
|
|
manifest: tc.IToolRelease[] | undefined
|
|
|
|
|
): Promise<string | undefined> {
|
|
|
|
|
try {
|
|
|
|
@ -353,7 +354,7 @@ export async function getInfoFromManifest(
|
|
|
|
|
versionSpec: string,
|
|
|
|
|
stable: boolean,
|
|
|
|
|
auth: string | undefined,
|
|
|
|
|
arch = os.arch(),
|
|
|
|
|
arch: Architecture = os.arch() as Architecture,
|
|
|
|
|
manifest?: tc.IToolRelease[] | undefined
|
|
|
|
|
): Promise<IGoVersionInfo | null> {
|
|
|
|
|
let info: IGoVersionInfo | null = null;
|
|
|
|
@ -379,7 +380,7 @@ export async function getInfoFromManifest(
|
|
|
|
|
|
|
|
|
|
async function getInfoFromDist(
|
|
|
|
|
versionSpec: string,
|
|
|
|
|
arch: string
|
|
|
|
|
arch: Architecture
|
|
|
|
|
): Promise<IGoVersionInfo | null> {
|
|
|
|
|
const version: IGoVersion | undefined = await findMatch(versionSpec, arch);
|
|
|
|
|
if (!version) {
|
|
|
|
@ -398,7 +399,7 @@ async function getInfoFromDist(
|
|
|
|
|
|
|
|
|
|
export async function findMatch(
|
|
|
|
|
versionSpec: string,
|
|
|
|
|
arch = os.arch()
|
|
|
|
|
arch: Architecture = os.arch() as Architecture
|
|
|
|
|
): Promise<IGoVersion | undefined> {
|
|
|
|
|
const archFilter = sys.getArch(arch);
|
|
|
|
|
const platFilter = sys.getPlatform();
|
|
|
|
@ -502,7 +503,7 @@ export function parseGoVersionFile(versionFilePath: string): string {
|
|
|
|
|
return contents.trim();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function resolveStableVersionDist(versionSpec: string, arch: string) {
|
|
|
|
|
async function resolveStableVersionDist(versionSpec: string, arch: Architecture) {
|
|
|
|
|
const archFilter = sys.getArch(arch);
|
|
|
|
|
const platFilter = sys.getPlatform();
|
|
|
|
|
const dlUrl = 'https://golang.org/dl/?mode=json&include=all';
|
|
|
|
|