Skip to content

Commit 3046faf

Browse files
committed
Add input for changing the Python version
1 parent 1377b85 commit 3046faf

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

Diff for: README.md

+19
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,25 @@ jobs:
5959
test_command: pytest --pyargs test_package
6060
```
6161
62+
## Custom Python version
63+
64+
By default, the [`actions/setup-python`](https://github.com/actions/setup-python) action will install the latest Python 3 version for building and testing, however, the `OpenAstronomy/build-python-dist` action accepts a `python-version` string input to select a specific version,
65+
66+
```yaml
67+
jobs:
68+
build_sdist:
69+
name: Build source distribution
70+
runs-on: ubuntu-latest
71+
steps:
72+
- uses: actions/checkout@v2
73+
- id: build
74+
uses: OpenAstronomy/build-python-dist@v1
75+
with:
76+
test_extras: test
77+
test_command: pytest --pyargs test_package
78+
python-version: '3.9'
79+
```
80+
6281
## Notes
6382

6483
If you want to use the latest available version of this action instead

Diff for: action.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ inputs:
1919
required: false
2020
default: false
2121
type: string
22+
python-version:
23+
description: The Python version to use for building and testing
24+
required: false
25+
default: '3.x'
26+
type: string
2227
runs:
2328
using: "composite"
2429
steps:
@@ -29,7 +34,7 @@ runs:
2934

3035
- uses: actions/setup-python@v2
3136
with:
32-
python-version: 3.x
37+
python-version: ${{ inputs.python-version }}
3338

3439
- name: Install python-build and twine
3540
shell: bash

0 commit comments

Comments
 (0)