3
0
Fork 0
mirror of https://gitea.com/actions/setup-python.git synced 2024-11-25 11:39:34 +01:00

Use python-version (#10)

This commit is contained in:
Danny McCormick 2019-08-13 16:30:18 -04:00 committed by GitHub
parent 3342d62b16
commit e336b852d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 6 deletions

View file

@ -19,7 +19,7 @@ steps:
- uses: actions/checkout@master - uses: actions/checkout@master
- uses: actions/setup-python@v1 - uses: actions/setup-python@v1
with: with:
version: '3.x' // Version range or exact version of a Python version to use, using semvers version range syntax. python-version: '3.x' // Version range or exact version of a Python version to use, using semvers version range syntax.
architecture: 'x64' // (x64 or x86) architecture: 'x64' // (x64 or x86)
- run: python my_script.py - run: python my_script.py
``` ```
@ -38,7 +38,7 @@ jobs:
- name: Setup python - name: Setup python
uses: actions/setup-python@v1 uses: actions/setup-python@v1
with: with:
version: ${{ matrix.python }} python-version: ${{ matrix.python }}
architecture: x64 architecture: x64
- run: python my_script.py - run: python my_script.py
``` ```

View file

@ -2,12 +2,15 @@ name: 'Setup Python environment'
description: 'Setup a Python environment and add it to the PATH, additionally providing proxy support' description: 'Setup a Python environment and add it to the PATH, additionally providing proxy support'
author: 'GitHub' author: 'GitHub'
inputs: inputs:
version: python-version:
description: 'Version range or exact version of a Python version to use, using semvers version range syntax.' description: 'Version range or exact version of a Python version to use, using semvers version range syntax.'
default: '3.x' default: '3.x'
architecture: architecture:
description: 'The target architecture (x86, x64) of the Python interpreter.' description: 'The target architecture (x86, x64) of the Python interpreter.'
default: 'x64' default: 'x64'
# Deprecated option, do not use. Will not be supported after October 1, 2019
version:
description: 'Deprecated. Use python-version instead. Will not be supported after October 1, 2019'
runs: runs:
using: 'node12' using: 'node12'
main: 'lib/setup-python.js' main: 'lib/setup-python.js'

View file

@ -21,7 +21,10 @@ const path = __importStar(require("path"));
function run() { function run() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
try { try {
const version = core.getInput('version'); let version = core.getInput('version');
if (!version) {
version = core.getInput('python-version');
}
if (version) { if (version) {
const arch = core.getInput('architecture', { required: true }); const arch = core.getInput('architecture', { required: true });
yield finder.findPythonVersion(version, arch); yield finder.findPythonVersion(version, arch);

View file

@ -4,7 +4,10 @@ import * as path from 'path';
async function run() { async function run() {
try { try {
const version: string = core.getInput('version'); let version = core.getInput('version');
if (!version) {
version = core.getInput('python-version');
}
if (version) { if (version) {
const arch: string = core.getInput('architecture', {required: true}); const arch: string = core.getInput('architecture', {required: true});
await finder.findPythonVersion(version, arch); await finder.findPythonVersion(version, arch);