@@ -62858,13 +62858,12 @@ const httpm = __importStar(__nccwpck_require__(6255));
6285862858const sys = __importStar(__nccwpck_require__(4300));
6285962859const fs_1 = __importDefault(__nccwpck_require__(7147));
6286062860const os_1 = __importDefault(__nccwpck_require__(2037));
62861- function getGo(versionSpec, checkLatest, auth) {
62861+ function getGo(versionSpec, checkLatest, auth, arch = os_1.default.arch() ) {
6286262862 return __awaiter(this, void 0, void 0, function* () {
6286362863 let osPlat = os_1.default.platform();
62864- let osArch = os_1.default.arch();
6286562864 if (checkLatest) {
6286662865 core.info('Attempting to resolve the latest version from the manifest...');
62867- const resolvedVersion = yield resolveVersionFromManifest(versionSpec, true, auth);
62866+ const resolvedVersion = yield resolveVersionFromManifest(versionSpec, true, auth, arch );
6286862867 if (resolvedVersion) {
6286962868 versionSpec = resolvedVersion;
6287062869 core.info(`Resolved as '${versionSpec}'`);
@@ -62875,7 +62874,7 @@ function getGo(versionSpec, checkLatest, auth) {
6287562874 }
6287662875 // check cache
6287762876 let toolPath;
62878- toolPath = tc.find('go', versionSpec);
62877+ toolPath = tc.find('go', versionSpec, arch );
6287962878 // If not found in cache, download
6288062879 if (toolPath) {
6288162880 core.info(`Found in cache @ ${toolPath}`);
@@ -62888,9 +62887,9 @@ function getGo(versionSpec, checkLatest, auth) {
6288862887 // Try download from internal distribution (popular versions only)
6288962888 //
6289062889 try {
62891- info = yield getInfoFromManifest(versionSpec, true, auth);
62890+ info = yield getInfoFromManifest(versionSpec, true, auth, arch );
6289262891 if (info) {
62893- downloadPath = yield installGoVersion(info, auth);
62892+ downloadPath = yield installGoVersion(info, auth, arch );
6289462893 }
6289562894 else {
6289662895 core.info('Not found in manifest. Falling back to download directly from Go');
@@ -62911,13 +62910,13 @@ function getGo(versionSpec, checkLatest, auth) {
6291162910 // Download from storage.googleapis.com
6291262911 //
6291362912 if (!downloadPath) {
62914- info = yield getInfoFromDist(versionSpec);
62913+ info = yield getInfoFromDist(versionSpec, arch );
6291562914 if (!info) {
62916- throw new Error(`Unable to find Go version '${versionSpec}' for platform ${osPlat} and architecture ${osArch }.`);
62915+ throw new Error(`Unable to find Go version '${versionSpec}' for platform ${osPlat} and architecture ${arch }.`);
6291762916 }
6291862917 try {
6291962918 core.info('Install from dist');
62920- downloadPath = yield installGoVersion(info, undefined);
62919+ downloadPath = yield installGoVersion(info, undefined, arch );
6292162920 }
6292262921 catch (err) {
6292362922 throw new Error(`Failed to download version ${versionSpec}: ${err}`);
@@ -62927,10 +62926,10 @@ function getGo(versionSpec, checkLatest, auth) {
6292762926 });
6292862927}
6292962928exports.getGo = getGo;
62930- function resolveVersionFromManifest(versionSpec, stable, auth) {
62929+ function resolveVersionFromManifest(versionSpec, stable, auth, arch ) {
6293162930 return __awaiter(this, void 0, void 0, function* () {
6293262931 try {
62933- const info = yield getInfoFromManifest(versionSpec, stable, auth);
62932+ const info = yield getInfoFromManifest(versionSpec, stable, auth, arch );
6293462933 return info === null || info === void 0 ? void 0 : info.resolvedVersion;
6293562934 }
6293662935 catch (err) {
@@ -62939,7 +62938,7 @@ function resolveVersionFromManifest(versionSpec, stable, auth) {
6293962938 }
6294062939 });
6294162940}
62942- function installGoVersion(info, auth) {
62941+ function installGoVersion(info, auth, arch ) {
6294362942 return __awaiter(this, void 0, void 0, function* () {
6294462943 core.info(`Acquiring ${info.resolvedVersion} from ${info.downloadUrl}`);
6294562944 // Windows requires that we keep the extension (.zip) for extraction
@@ -62954,7 +62953,7 @@ function installGoVersion(info, auth) {
6295462953 extPath = path.join(extPath, 'go');
6295562954 }
6295662955 core.info('Adding to the cache ...');
62957- const cachedDir = yield tc.cacheDir(extPath, 'go', makeSemver(info.resolvedVersion));
62956+ const cachedDir = yield tc.cacheDir(extPath, 'go', makeSemver(info.resolvedVersion), arch );
6295862957 core.info(`Successfully cached go to ${cachedDir}`);
6295962958 return cachedDir;
6296062959 });
@@ -62973,12 +62972,12 @@ function extractGoArchive(archivePath) {
6297362972 });
6297462973}
6297562974exports.extractGoArchive = extractGoArchive;
62976- function getInfoFromManifest(versionSpec, stable, auth) {
62975+ function getInfoFromManifest(versionSpec, stable, auth, arch = os_1.default.arch() ) {
6297762976 return __awaiter(this, void 0, void 0, function* () {
6297862977 let info = null;
6297962978 const releases = yield tc.getManifestFromRepo('actions', 'go-versions', auth, 'main');
6298062979 core.info(`matching ${versionSpec}...`);
62981- const rel = yield tc.findFromManifest(versionSpec, stable, releases);
62980+ const rel = yield tc.findFromManifest(versionSpec, stable, releases, arch );
6298262981 if (rel && rel.files.length > 0) {
6298362982 info = {};
6298462983 info.type = 'manifest';
@@ -62990,10 +62989,10 @@ function getInfoFromManifest(versionSpec, stable, auth) {
6299062989 });
6299162990}
6299262991exports.getInfoFromManifest = getInfoFromManifest;
62993- function getInfoFromDist(versionSpec) {
62992+ function getInfoFromDist(versionSpec, arch ) {
6299462993 return __awaiter(this, void 0, void 0, function* () {
6299562994 let version;
62996- version = yield findMatch(versionSpec);
62995+ version = yield findMatch(versionSpec, arch );
6299762996 if (!version) {
6299862997 return null;
6299962998 }
@@ -63006,9 +63005,9 @@ function getInfoFromDist(versionSpec) {
6300663005 };
6300763006 });
6300863007}
63009- function findMatch(versionSpec) {
63008+ function findMatch(versionSpec, arch = os_1.default.arch() ) {
6301063009 return __awaiter(this, void 0, void 0, function* () {
63011- let archFilter = sys.getArch();
63010+ let archFilter = sys.getArch(arch );
6301263011 let platFilter = sys.getPlatform();
6301363012 let result;
6301463013 let match;
@@ -63139,6 +63138,7 @@ const cache_restore_1 = __nccwpck_require__(9517);
6313963138const cache_utils_1 = __nccwpck_require__(1678);
6314063139const child_process_1 = __importDefault(__nccwpck_require__(2081));
6314163140const fs_1 = __importDefault(__nccwpck_require__(7147));
63141+ const os_1 = __importDefault(__nccwpck_require__(2037));
6314263142function run() {
6314363143 return __awaiter(this, void 0, void 0, function* () {
6314463144 try {
@@ -63149,11 +63149,15 @@ function run() {
6314963149 const versionSpec = resolveVersionInput();
6315063150 const cache = core.getBooleanInput('cache');
6315163151 core.info(`Setup go version spec ${versionSpec}`);
63152+ let arch = core.getInput('architecture');
63153+ if (!arch) {
63154+ arch = os_1.default.arch();
63155+ }
6315263156 if (versionSpec) {
6315363157 let token = core.getInput('token');
6315463158 let auth = !token || cache_utils_1.isGhes() ? undefined : `token ${token}`;
6315563159 const checkLatest = core.getBooleanInput('check-latest');
63156- const installDir = yield installer.getGo(versionSpec, checkLatest, auth);
63160+ const installDir = yield installer.getGo(versionSpec, checkLatest, auth, arch );
6315763161 core.addPath(path_1.default.join(installDir, 'bin'));
6315863162 core.info('Added go to the path');
6315963163 const version = installer.makeSemver(versionSpec);
@@ -63286,9 +63290,8 @@ function getPlatform() {
6328663290 return plat;
6328763291}
6328863292exports.getPlatform = getPlatform;
63289- function getArch() {
63293+ function getArch(arch ) {
6329063294 // 'arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 's390', 's390x', 'x32', and 'x64'.
63291- let arch = os.arch();
6329263295 // wants amd64, 386, arm64, armv61, ppc641e, s390x
6329363296 // currently not supported by runner but future proofed mapping
6329463297 switch (arch) {
@@ -63301,6 +63304,9 @@ function getArch() {
6330163304 case 'x32':
6330263305 arch = '386';
6330363306 break;
63307+ case 'arm':
63308+ arch = 'armv6l';
63309+ break;
6330463310 }
6330563311 return arch;
6330663312}
0 commit comments