mirror of
https://github.com/actions/setup-python.git
synced 2025-07-02 23:53:47 +00:00
add support for python-version-file
This commit is contained in:
parent
7f80679172
commit
5d2a3532c1
5 changed files with 89 additions and 2 deletions
19
dist/setup/index.js
vendored
19
dist/setup/index.js
vendored
|
@ -6622,12 +6622,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const finder = __importStar(__webpack_require__(927));
|
||||
const finderPyPy = __importStar(__webpack_require__(50));
|
||||
const path = __importStar(__webpack_require__(622));
|
||||
const os = __importStar(__webpack_require__(87));
|
||||
const fs_1 = __importDefault(__webpack_require__(747));
|
||||
const cache_factory_1 = __webpack_require__(633);
|
||||
const utils_1 = __webpack_require__(163);
|
||||
function isPyPyVersion(versionSpec) {
|
||||
|
@ -6643,10 +6647,23 @@ function cacheDependencies(cache, pythonVersion) {
|
|||
yield cacheDistributor.restoreCache();
|
||||
});
|
||||
}
|
||||
function resolveVersionInput() {
|
||||
let version = core.getInput('python-version');
|
||||
const versionFileInput = core.getInput('python-version-file');
|
||||
if (versionFileInput) {
|
||||
const versionFilePath = path.join(process.env.GITHUB_WORKSPACE, versionFileInput);
|
||||
if (!fs_1.default.existsSync(versionFilePath)) {
|
||||
throw new Error(`The specified node version file at: ${versionFilePath} does not exist`);
|
||||
}
|
||||
version = fs_1.default.readFileSync(versionFilePath, 'utf8');
|
||||
core.info(`Resolved ${versionFileInput} as ${version}`);
|
||||
}
|
||||
return version;
|
||||
}
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const version = core.getInput('python-version');
|
||||
const version = resolveVersionInput();
|
||||
if (version) {
|
||||
let pythonVersion;
|
||||
const arch = core.getInput('architecture') || os.arch();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue