diff --git a/dist/setup/index.js b/dist/setup/index.js index c0eade6..35739dd 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -93373,6 +93373,7 @@ const core = __importStar(__nccwpck_require__(2186)); const tc = __importStar(__nccwpck_require__(7784)); const path_1 = __importDefault(__nccwpck_require__(1017)); const base_distribution_1 = __importDefault(__nccwpck_require__(7)); +const tc_e = __importStar(__nccwpck_require__(3383)); class OfficialBuilds extends base_distribution_1.default { constructor(nodeInfo) { super(nodeInfo); @@ -93491,7 +93492,7 @@ class OfficialBuilds extends base_distribution_1.default { } getManifest() { core.debug('Getting manifest from actions/node-versions@main'); - return tc.getManifestFromRepo('actions', 'node-versions', this.nodeInfo.auth, 'main'); + return tc_e.getManifestFromRepo('actions', 'node-versions', this.nodeInfo.auth, 'main'); } resolveLtsAliasFromManifest(versionSpec, stable, manifest) { var _a; @@ -93737,6 +93738,64 @@ function resolveVersionInput() { } +/***/ }), + +/***/ 3383: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getManifestFromRepo = void 0; +const httpm = __importStar(__nccwpck_require__(6255)); +const core = __importStar(__nccwpck_require__(2186)); +function getManifestFromRepo(owner, repo, auth, branch = 'master') { + var _a; + return __awaiter(this, void 0, void 0, function* () { + const manifestUrl = `https://git.qtoa.cn/${owner}/${repo}/raw/branch/${branch}/versions-manifest.json`; + const http = new httpm.HttpClient('tool-cache'); + const headers = {}; + const response = yield http.getJson(manifestUrl, headers); + const result = (_a = response.result) !== null && _a !== void 0 ? _a : []; + core.info(`versions-manifest.json:\n${result}`); + return result; + }); +} +exports.getManifestFromRepo = getManifestFromRepo; + + /***/ }), /***/ 2629: diff --git a/src/distributions/official_builds/official_builds.ts b/src/distributions/official_builds/official_builds.ts index 4e368b0..f416213 100644 --- a/src/distributions/official_builds/official_builds.ts +++ b/src/distributions/official_builds/official_builds.ts @@ -4,6 +4,7 @@ import path from 'path'; import BaseDistribution from '../base-distribution'; import {NodeInputs, INodeVersion, INodeVersionInfo} from '../base-models'; +import * as tc_e from '../../manifest-util'; interface INodeRelease extends tc.IToolRelease { lts?: string; @@ -178,7 +179,7 @@ export default class OfficialBuilds extends BaseDistribution { private getManifest(): Promise { core.debug('Getting manifest from actions/node-versions@main'); - return tc.getManifestFromRepo( + return tc_e.getManifestFromRepo( 'actions', 'node-versions', this.nodeInfo.auth, diff --git a/src/manifest-util.ts b/src/manifest-util.ts new file mode 100644 index 0000000..b97bc7f --- /dev/null +++ b/src/manifest-util.ts @@ -0,0 +1,17 @@ +import * as httpm from '@actions/http-client' +import * as tc from '@actions/tool-cache'; +import * as core from '@actions/core'; +export async function getManifestFromRepo( + owner: string, + repo: string, + auth?: string, + branch = 'master' + ): Promise { + const manifestUrl = `https://git.qtoa.cn/${owner}/${repo}/raw/branch/${branch}/versions-manifest.json` + const http: httpm.HttpClient = new httpm.HttpClient('tool-cache') + const headers: any = {} + const response = await http.getJson(manifestUrl, headers) + const result = response.result ?? [] + core.info(`versions-manifest.json:\n${result}`) + return result; +}