Skip to content

Commit e336b85

Browse files
author
Danny McCormick
authored
Use python-version (#10)
1 parent 3342d62 commit e336b85

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ steps:
1919
- uses: actions/checkout@master
2020
- uses: actions/setup-python@v1
2121
with:
22-
version: '3.x' // Version range or exact version of a Python version to use, using semvers version range syntax.
22+
python-version: '3.x' // Version range or exact version of a Python version to use, using semvers version range syntax.
2323
architecture: 'x64' // (x64 or x86)
2424
- run: python my_script.py
2525
```
@@ -38,7 +38,7 @@ jobs:
3838
- name: Setup python
3939
uses: actions/setup-python@v1
4040
with:
41-
version: ${{ matrix.python }}
41+
python-version: ${{ matrix.python }}
4242
architecture: x64
4343
- run: python my_script.py
4444
```

action.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
name: 'Setup Python environment'
22
description: 'Setup a Python environment and add it to the PATH, additionally providing proxy support'
33
author: 'GitHub'
4-
inputs:
5-
version:
4+
inputs:
5+
python-version:
66
description: 'Version range or exact version of a Python version to use, using semvers version range syntax.'
77
default: '3.x'
88
architecture:
99
description: 'The target architecture (x86, x64) of the Python interpreter.'
1010
default: 'x64'
11+
# Deprecated option, do not use. Will not be supported after October 1, 2019
12+
version:
13+
description: 'Deprecated. Use python-version instead. Will not be supported after October 1, 2019'
1114
runs:
1215
using: 'node12'
1316
main: 'lib/setup-python.js'

lib/setup-python.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ const path = __importStar(require("path"));
2121
function run() {
2222
return __awaiter(this, void 0, void 0, function* () {
2323
try {
24-
const version = core.getInput('version');
24+
let version = core.getInput('version');
25+
if (!version) {
26+
version = core.getInput('python-version');
27+
}
2528
if (version) {
2629
const arch = core.getInput('architecture', { required: true });
2730
yield finder.findPythonVersion(version, arch);

src/setup-python.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ import * as path from 'path';
44

55
async function run() {
66
try {
7-
const version: string = core.getInput('version');
7+
let version = core.getInput('version');
8+
if (!version) {
9+
version = core.getInput('python-version');
10+
}
811
if (version) {
912
const arch: string = core.getInput('architecture', {required: true});
1013
await finder.findPythonVersion(version, arch);

0 commit comments

Comments
 (0)