@@ -62858,13 +62858,12 @@ const httpm = __importStar(__nccwpck_require__(6255));
62858
62858
const sys = __importStar(__nccwpck_require__(4300));
62859
62859
const fs_1 = __importDefault(__nccwpck_require__(7147));
62860
62860
const os_1 = __importDefault(__nccwpck_require__(2037));
62861
- function getGo(versionSpec, checkLatest, auth) {
62861
+ function getGo(versionSpec, checkLatest, auth, arch = os_1.default.arch() ) {
62862
62862
return __awaiter(this, void 0, void 0, function* () {
62863
62863
let osPlat = os_1.default.platform();
62864
- let osArch = os_1.default.arch();
62865
62864
if (checkLatest) {
62866
62865
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 );
62868
62867
if (resolvedVersion) {
62869
62868
versionSpec = resolvedVersion;
62870
62869
core.info(`Resolved as '${versionSpec}'`);
@@ -62875,7 +62874,7 @@ function getGo(versionSpec, checkLatest, auth) {
62875
62874
}
62876
62875
// check cache
62877
62876
let toolPath;
62878
- toolPath = tc.find('go', versionSpec);
62877
+ toolPath = tc.find('go', versionSpec, arch );
62879
62878
// If not found in cache, download
62880
62879
if (toolPath) {
62881
62880
core.info(`Found in cache @ ${toolPath}`);
@@ -62888,9 +62887,9 @@ function getGo(versionSpec, checkLatest, auth) {
62888
62887
// Try download from internal distribution (popular versions only)
62889
62888
//
62890
62889
try {
62891
- info = yield getInfoFromManifest(versionSpec, true, auth);
62890
+ info = yield getInfoFromManifest(versionSpec, true, auth, arch );
62892
62891
if (info) {
62893
- downloadPath = yield installGoVersion(info, auth);
62892
+ downloadPath = yield installGoVersion(info, auth, arch );
62894
62893
}
62895
62894
else {
62896
62895
core.info('Not found in manifest. Falling back to download directly from Go');
@@ -62911,13 +62910,13 @@ function getGo(versionSpec, checkLatest, auth) {
62911
62910
// Download from storage.googleapis.com
62912
62911
//
62913
62912
if (!downloadPath) {
62914
- info = yield getInfoFromDist(versionSpec);
62913
+ info = yield getInfoFromDist(versionSpec, arch );
62915
62914
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 }.`);
62917
62916
}
62918
62917
try {
62919
62918
core.info('Install from dist');
62920
- downloadPath = yield installGoVersion(info, undefined);
62919
+ downloadPath = yield installGoVersion(info, undefined, arch );
62921
62920
}
62922
62921
catch (err) {
62923
62922
throw new Error(`Failed to download version ${versionSpec}: ${err}`);
@@ -62927,10 +62926,10 @@ function getGo(versionSpec, checkLatest, auth) {
62927
62926
});
62928
62927
}
62929
62928
exports.getGo = getGo;
62930
- function resolveVersionFromManifest(versionSpec, stable, auth) {
62929
+ function resolveVersionFromManifest(versionSpec, stable, auth, arch ) {
62931
62930
return __awaiter(this, void 0, void 0, function* () {
62932
62931
try {
62933
- const info = yield getInfoFromManifest(versionSpec, stable, auth);
62932
+ const info = yield getInfoFromManifest(versionSpec, stable, auth, arch );
62934
62933
return info === null || info === void 0 ? void 0 : info.resolvedVersion;
62935
62934
}
62936
62935
catch (err) {
@@ -62939,7 +62938,7 @@ function resolveVersionFromManifest(versionSpec, stable, auth) {
62939
62938
}
62940
62939
});
62941
62940
}
62942
- function installGoVersion(info, auth) {
62941
+ function installGoVersion(info, auth, arch ) {
62943
62942
return __awaiter(this, void 0, void 0, function* () {
62944
62943
core.info(`Acquiring ${info.resolvedVersion} from ${info.downloadUrl}`);
62945
62944
// Windows requires that we keep the extension (.zip) for extraction
@@ -62954,7 +62953,7 @@ function installGoVersion(info, auth) {
62954
62953
extPath = path.join(extPath, 'go');
62955
62954
}
62956
62955
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 );
62958
62957
core.info(`Successfully cached go to ${cachedDir}`);
62959
62958
return cachedDir;
62960
62959
});
@@ -62973,12 +62972,12 @@ function extractGoArchive(archivePath) {
62973
62972
});
62974
62973
}
62975
62974
exports.extractGoArchive = extractGoArchive;
62976
- function getInfoFromManifest(versionSpec, stable, auth) {
62975
+ function getInfoFromManifest(versionSpec, stable, auth, arch = os_1.default.arch() ) {
62977
62976
return __awaiter(this, void 0, void 0, function* () {
62978
62977
let info = null;
62979
62978
const releases = yield tc.getManifestFromRepo('actions', 'go-versions', auth, 'main');
62980
62979
core.info(`matching ${versionSpec}...`);
62981
- const rel = yield tc.findFromManifest(versionSpec, stable, releases);
62980
+ const rel = yield tc.findFromManifest(versionSpec, stable, releases, arch );
62982
62981
if (rel && rel.files.length > 0) {
62983
62982
info = {};
62984
62983
info.type = 'manifest';
@@ -62990,10 +62989,10 @@ function getInfoFromManifest(versionSpec, stable, auth) {
62990
62989
});
62991
62990
}
62992
62991
exports.getInfoFromManifest = getInfoFromManifest;
62993
- function getInfoFromDist(versionSpec) {
62992
+ function getInfoFromDist(versionSpec, arch ) {
62994
62993
return __awaiter(this, void 0, void 0, function* () {
62995
62994
let version;
62996
- version = yield findMatch(versionSpec);
62995
+ version = yield findMatch(versionSpec, arch );
62997
62996
if (!version) {
62998
62997
return null;
62999
62998
}
@@ -63006,9 +63005,9 @@ function getInfoFromDist(versionSpec) {
63006
63005
};
63007
63006
});
63008
63007
}
63009
- function findMatch(versionSpec) {
63008
+ function findMatch(versionSpec, arch = os_1.default.arch() ) {
63010
63009
return __awaiter(this, void 0, void 0, function* () {
63011
- let archFilter = sys.getArch();
63010
+ let archFilter = sys.getArch(arch );
63012
63011
let platFilter = sys.getPlatform();
63013
63012
let result;
63014
63013
let match;
@@ -63139,6 +63138,7 @@ const cache_restore_1 = __nccwpck_require__(9517);
63139
63138
const cache_utils_1 = __nccwpck_require__(1678);
63140
63139
const child_process_1 = __importDefault(__nccwpck_require__(2081));
63141
63140
const fs_1 = __importDefault(__nccwpck_require__(7147));
63141
+ const os_1 = __importDefault(__nccwpck_require__(2037));
63142
63142
function run() {
63143
63143
return __awaiter(this, void 0, void 0, function* () {
63144
63144
try {
@@ -63149,11 +63149,15 @@ function run() {
63149
63149
const versionSpec = resolveVersionInput();
63150
63150
const cache = core.getBooleanInput('cache');
63151
63151
core.info(`Setup go version spec ${versionSpec}`);
63152
+ let arch = core.getInput('architecture');
63153
+ if (!arch) {
63154
+ arch = os_1.default.arch();
63155
+ }
63152
63156
if (versionSpec) {
63153
63157
let token = core.getInput('token');
63154
63158
let auth = !token || cache_utils_1.isGhes() ? undefined : `token ${token}`;
63155
63159
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 );
63157
63161
core.addPath(path_1.default.join(installDir, 'bin'));
63158
63162
core.info('Added go to the path');
63159
63163
const version = installer.makeSemver(versionSpec);
@@ -63286,9 +63290,8 @@ function getPlatform() {
63286
63290
return plat;
63287
63291
}
63288
63292
exports.getPlatform = getPlatform;
63289
- function getArch() {
63293
+ function getArch(arch ) {
63290
63294
// 'arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 's390', 's390x', 'x32', and 'x64'.
63291
- let arch = os.arch();
63292
63295
// wants amd64, 386, arm64, armv61, ppc641e, s390x
63293
63296
// currently not supported by runner but future proofed mapping
63294
63297
switch (arch) {
@@ -63301,6 +63304,9 @@ function getArch() {
63301
63304
case 'x32':
63302
63305
arch = '386';
63303
63306
break;
63307
+ case 'arm':
63308
+ arch = 'armv6l';
63309
+ break;
63304
63310
}
63305
63311
return arch;
63306
63312
}
0 commit comments