Skip to content

Commit ee675d7

Browse files
authored
Merge pull request #3 from dmitry-shibanov/test-dist-aliases
Add aliases for dist
2 parents ece959c + f623296 commit ee675d7

File tree

6 files changed

+98
-55
lines changed

6 files changed

+98
-55
lines changed

dist/cache-save/index.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60313,7 +60313,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
6031360313
var __importStar = (this && this.__importStar) || function (mod) {
6031460314
if (mod && mod.__esModule) return mod;
6031560315
var result = {};
60316-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
60316+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
6031760317
__setModuleDefault(result, mod);
6031860318
return result;
6031960319
};
@@ -60418,7 +60418,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
6041860418
var __importStar = (this && this.__importStar) || function (mod) {
6041960419
if (mod && mod.__esModule) return mod;
6042060420
var result = {};
60421-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
60421+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
6042260422
__setModuleDefault(result, mod);
6042360423
return result;
6042460424
};
@@ -60437,7 +60437,7 @@ const cache = __importStar(__nccwpck_require__(7799));
6043760437
const core = __importStar(__nccwpck_require__(2186));
6043860438
const exec = __importStar(__nccwpck_require__(1514));
6043960439
const package_managers_1 = __nccwpck_require__(6663);
60440-
exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
60440+
const getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
6044160441
let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true });
6044260442
if (exitCode) {
6044360443
stderr = !stderr.trim()
@@ -60447,21 +60447,24 @@ exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, fu
6044760447
}
6044860448
return stdout.trim();
6044960449
});
60450-
exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
60450+
exports.getCommandOutput = getCommandOutput;
60451+
const getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
6045160452
if (!package_managers_1.supportedPackageManagers[packageManager]) {
6045260453
throw new Error(`It's not possible to use ${packageManager}, please, check correctness of the package manager name spelling.`);
6045360454
}
6045460455
const obtainedPackageManager = package_managers_1.supportedPackageManagers[packageManager];
6045560456
return obtainedPackageManager;
6045660457
});
60457-
exports.getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0, void 0, function* () {
60458+
exports.getPackageManagerInfo = getPackageManagerInfo;
60459+
const getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0, void 0, function* () {
6045860460
let pathList = yield Promise.all(packageManagerInfo.cacheFolderCommandList.map(command => exports.getCommandOutput(command)));
6045960461
const emptyPaths = pathList.filter(item => !item);
6046060462
if (emptyPaths.length) {
6046160463
throw new Error(`Could not get cache folder paths.`);
6046260464
}
6046360465
return pathList;
6046460466
});
60467+
exports.getCacheDirectoryPath = getCacheDirectoryPath;
6046560468
function isGhes() {
6046660469
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
6046760470
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';

dist/setup/index.js

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63007,7 +63007,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
6300763007
var __importStar = (this && this.__importStar) || function (mod) {
6300863008
if (mod && mod.__esModule) return mod;
6300963009
var result = {};
63010-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
63010+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
6301163011
__setModuleDefault(result, mod);
6301263012
return result;
6301363013
};
@@ -63032,7 +63032,7 @@ const path_1 = __importDefault(__nccwpck_require__(1017));
6303263032
const fs_1 = __importDefault(__nccwpck_require__(7147));
6303363033
const constants_1 = __nccwpck_require__(9042);
6303463034
const cache_utils_1 = __nccwpck_require__(1678);
63035-
exports.restoreCache = (versionSpec, packageManager, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
63035+
const restoreCache = (versionSpec, packageManager, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
6303663036
const packageManagerInfo = yield cache_utils_1.getPackageManagerInfo(packageManager);
6303763037
const platform = process.env.RUNNER_OS;
6303863038
const cachePaths = yield cache_utils_1.getCacheDirectoryPath(packageManagerInfo);
@@ -63056,6 +63056,7 @@ exports.restoreCache = (versionSpec, packageManager, cacheDependencyPath) => __a
6305663056
core.saveState(constants_1.State.CacheMatchedKey, cacheKey);
6305763057
core.info(`Cache restored from key: ${cacheKey}`);
6305863058
});
63059+
exports.restoreCache = restoreCache;
6305963060
const findDependencyFile = (packageManager) => {
6306063061
let dependencyFile = packageManager.dependencyFilePattern;
6306163062
const workspace = process.env.GITHUB_WORKSPACE;
@@ -63090,7 +63091,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
6309063091
var __importStar = (this && this.__importStar) || function (mod) {
6309163092
if (mod && mod.__esModule) return mod;
6309263093
var result = {};
63093-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
63094+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
6309463095
__setModuleDefault(result, mod);
6309563096
return result;
6309663097
};
@@ -63109,7 +63110,7 @@ const cache = __importStar(__nccwpck_require__(7799));
6310963110
const core = __importStar(__nccwpck_require__(2186));
6311063111
const exec = __importStar(__nccwpck_require__(1514));
6311163112
const package_managers_1 = __nccwpck_require__(6663);
63112-
exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
63113+
const getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
6311363114
let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true });
6311463115
if (exitCode) {
6311563116
stderr = !stderr.trim()
@@ -63119,21 +63120,24 @@ exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, fu
6311963120
}
6312063121
return stdout.trim();
6312163122
});
63122-
exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
63123+
exports.getCommandOutput = getCommandOutput;
63124+
const getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
6312363125
if (!package_managers_1.supportedPackageManagers[packageManager]) {
6312463126
throw new Error(`It's not possible to use ${packageManager}, please, check correctness of the package manager name spelling.`);
6312563127
}
6312663128
const obtainedPackageManager = package_managers_1.supportedPackageManagers[packageManager];
6312763129
return obtainedPackageManager;
6312863130
});
63129-
exports.getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0, void 0, function* () {
63131+
exports.getPackageManagerInfo = getPackageManagerInfo;
63132+
const getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0, void 0, function* () {
6313063133
let pathList = yield Promise.all(packageManagerInfo.cacheFolderCommandList.map(command => exports.getCommandOutput(command)));
6313163134
const emptyPaths = pathList.filter(item => !item);
6313263135
if (emptyPaths.length) {
6313363136
throw new Error(`Could not get cache folder paths.`);
6313463137
}
6313563138
return pathList;
6313663139
});
63140+
exports.getCacheDirectoryPath = getCacheDirectoryPath;
6313763141
function isGhes() {
6313863142
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
6313963143
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
@@ -63196,7 +63200,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
6319663200
var __importStar = (this && this.__importStar) || function (mod) {
6319763201
if (mod && mod.__esModule) return mod;
6319863202
var result = {};
63199-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
63203+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
6320063204
__setModuleDefault(result, mod);
6320163205
return result;
6320263206
};
@@ -63223,11 +63227,13 @@ const sys = __importStar(__nccwpck_require__(4300));
6322363227
const fs_1 = __importDefault(__nccwpck_require__(7147));
6322463228
const os_1 = __importDefault(__nccwpck_require__(2037));
6322563229
const utils_1 = __nccwpck_require__(1314);
63226-
function getGo(versionSpec, checkLatest, auth, arch = os_1.default.arch(), manifest) {
63230+
function getGo(versionSpec, checkLatest, auth, arch = os_1.default.arch()) {
6322763231
return __awaiter(this, void 0, void 0, function* () {
63232+
let manifest;
6322863233
let osPlat = os_1.default.platform();
6322963234
if (checkLatest) {
6323063235
core.info('Attempting to resolve the latest version from the manifest...');
63236+
manifest = yield getManifest(auth);
6323163237
const resolvedVersion = yield resolveVersionFromManifest(versionSpec, true, auth, arch, manifest);
6323263238
if (resolvedVersion) {
6323363239
versionSpec = resolvedVersion;
@@ -63239,6 +63245,7 @@ function getGo(versionSpec, checkLatest, auth, arch = os_1.default.arch(), manif
6323963245
}
6324063246
if (versionSpec === utils_1.StableReleaseAlias.Stable ||
6324163247
versionSpec === utils_1.StableReleaseAlias.OldStable) {
63248+
manifest !== null && manifest !== void 0 ? manifest : (manifest = yield getManifest(auth));
6324263249
versionSpec = yield resolveStableVersionInput(versionSpec, auth, arch, manifest);
6324363250
}
6324463251
// check cache
@@ -63394,6 +63401,13 @@ function findMatch(versionSpec, arch = os_1.default.arch()) {
6339463401
if (!candidates) {
6339563402
throw new Error(`golang download url did not return results`);
6339663403
}
63404+
if (versionSpec === utils_1.StableReleaseAlias.Stable ||
63405+
versionSpec === utils_1.StableReleaseAlias.OldStable) {
63406+
const fixedCandidates = candidates.map(item => {
63407+
return Object.assign(Object.assign({}, item), { version: makeSemver(item.version) });
63408+
});
63409+
versionSpec = yield resolveStableVersionInput(versionSpec, undefined, arch, fixedCandidates);
63410+
}
6339763411
let goFile;
6339863412
for (let i = 0; i < candidates.length; i++) {
6339963413
let candidate = candidates[i];
@@ -63472,20 +63486,28 @@ function resolveStableVersionInput(versionSpec, auth, arch = os_1.default.arch()
6347263486
core.debug('No manifest cached');
6347363487
manifest = yield getManifest(auth);
6347463488
}
63475-
const releases = manifest.map(release => release.version);
63489+
const releases = manifest
63490+
.map(item => {
63491+
const index = item.files.findIndex(item => item.arch === arch);
63492+
if (index === -1) {
63493+
return '';
63494+
}
63495+
return item.version;
63496+
})
63497+
.filter(item => !!item);
6347663498
if (versionSpec === utils_1.StableReleaseAlias.Stable) {
6347763499
core.info(`stable version resolved as ${releases[0]}`);
6347863500
return releases[0];
6347963501
}
6348063502
else {
6348163503
const versions = releases.map(release => `${semver.major(release)}.${semver.minor(release)}`);
6348263504
const uniqueVersions = Array.from(new Set(versions));
63483-
const oldstableVersion = yield getInfoFromManifest(uniqueVersions[1], true, auth, arch, manifest);
63484-
core.info(`oldstable version resolved as ${oldstableVersion === null || oldstableVersion === void 0 ? void 0 : oldstableVersion.resolvedVersion}`);
63505+
const oldstableVersion = releases.find(item => item.startsWith(uniqueVersions[1]));
63506+
core.info(`oldstable version resolved as ${oldstableVersion}`);
6348563507
if (!oldstableVersion) {
6348663508
return versionSpec;
6348763509
}
63488-
return oldstableVersion.resolvedVersion;
63510+
return oldstableVersion;
6348963511
}
6349063512
});
6349163513
}
@@ -63514,7 +63536,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
6351463536
var __importStar = (this && this.__importStar) || function (mod) {
6351563537
if (mod && mod.__esModule) return mod;
6351663538
var result = {};
63517-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
63539+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
6351863540
__setModuleDefault(result, mod);
6351963541
return result;
6352063542
};
@@ -63559,9 +63581,8 @@ function run() {
6355963581
if (versionSpec) {
6356063582
let token = core.getInput('token');
6356163583
let auth = !token ? undefined : `token ${token}`;
63562-
const manifest = yield installer.getManifest(auth);
6356363584
const checkLatest = core.getBooleanInput('check-latest');
63564-
const installDir = yield installer.getGo(versionSpec, checkLatest, auth, arch, manifest);
63585+
const installDir = yield installer.getGo(versionSpec, checkLatest, auth, arch);
6356563586
const installDirVersion = path_1.default.basename(path_1.default.dirname(installDir));
6356663587
core.addPath(path_1.default.join(installDir, 'bin'));
6356763588
core.info('Added go to the path');

package-lock.json

Lines changed: 18 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
"jest": "^27.2.5",
4141
"jest-circus": "^27.2.5",
4242
"nock": "^10.0.6",
43-
"prettier": "^1.17.1",
43+
"prettier": "^2.8.0",
4444
"ts-jest": "^27.0.5",
45-
"typescript": "^3.8.3"
45+
"typescript": "^4.3.3"
4646
}
4747
}

0 commit comments

Comments
 (0)