From 3046faf3b3139146f7b8442c9639b719943ba8d4 Mon Sep 17 00:00:00 2001 From: Conor MacBride Date: Thu, 7 Apr 2022 17:08:34 +0100 Subject: [PATCH] Add input for changing the Python version --- README.md | 19 +++++++++++++++++++ action.yml | 7 ++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9a93f3d..6bb9838 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,25 @@ jobs: test_command: pytest --pyargs test_package ``` +## Custom Python version + +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, + +```yaml +jobs: + build_sdist: + name: Build source distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - id: build + uses: OpenAstronomy/build-python-dist@v1 + with: + test_extras: test + test_command: pytest --pyargs test_package + python-version: '3.9' +``` + ## Notes If you want to use the latest available version of this action instead diff --git a/action.yml b/action.yml index 5238cc3..7fba7b3 100644 --- a/action.yml +++ b/action.yml @@ -19,6 +19,11 @@ inputs: required: false default: false type: string + python-version: + description: The Python version to use for building and testing + required: false + default: '3.x' + type: string runs: using: "composite" steps: @@ -29,7 +34,7 @@ runs: - uses: actions/setup-python@v2 with: - python-version: 3.x + python-version: ${{ inputs.python-version }} - name: Install python-build and twine shell: bash