Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable reading python version from pyproject.toml #189

Merged
merged 4 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions .github/workflows/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11]
python-version: [3.12]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -33,7 +33,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9, '3.10', 3.11]
python-version: [3.9, '3.10', 3.11, 3.12]
steps:
- uses: actions/checkout@v4
- id: local-action
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9, '3.10', 3.11]
python-version: [3.9, '3.10', 3.11, 3.12]
steps:
- uses: actions/checkout@v4
- id: local-action
Expand All @@ -87,3 +87,15 @@ jobs:
exit 1
- name: ensure pre-commit is installed
run: poetry run pre-commit sample-config
test-local-action-python-version-file:
name: Test Local Action Using Version From File
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: local-action
uses: ./
with:
cache-key-suffix: ${{ github.run_number }}-from-file
poetry-install: false
- name: ensure python version
run: python -c "import sys; assert sys.version_info >= (3, 12);"
13 changes: 13 additions & 0 deletions .github/workflows/on-pr-target-opened.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@ on:
jobs:
assign-author:
name: Assign Author to PR
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- uses: technote-space/assign-author@v1 # cspell:ignore technote
label-pr:
name: Label PR
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v6.0.0
with:
disable-releaser: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10 changes: 0 additions & 10 deletions .github/workflows/on-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,3 @@ jobs:
regex: ([a-z])+\/([a-zA-Z0-9\-\_])+
allowed_prefixes: bugfix,chore,depend,dependencies,dependabot,docs,feat,feature,fix,hotfix,maint,maintain,maintenance,release
ignore: master,release,develop
label-pr:
name: Label PR
# skip running the job from forks
# uncomment and replace with the name of the repo
# if: github.repository == 'ITProKyle/generic-template'
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v6.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .github/workflows/release-management.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ on:
jobs:
update-release-draft:
name: Draft Release
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v6.0.0
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ steps:
| poetry-install-cmd | Command for installing poetry project. Can be used to provide a custom install command. The value of `poetry-install-args` is appended after this. Defaults to `poetry install`. This is also a check for the existence of a `Makefile` with a `setup-poetry` target. If found, using it takes precedence. |
| poetry-preview | Allow install of prerelease versions of Poetry. |
| poetry-version | Poetry version to use. If version is not provided then latest stable version will be used. |
| python-version | Version range or exact version of a Python version to use, using semver version range syntax. |
| python-version | Version range or exact version of a Python version to use, using semver version range syntax. Reads from `pyproject.toml` if unset. |
| python-version-file | File containing the Python version to use. |
| token | Used to pull python distributions from actions/python-versions. Since there's a default, this is typically not supplied by the user. |

### Outputs
Expand Down
27 changes: 24 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,13 @@ inputs:
description: Poetry version to use. If version is not provided then latest stable version will be used.
required: false
python-version:
description: Version range or exact version of a Python version to use, using semver version range syntax.
default: 3.x
description: Version range or exact version of a Python version to use, using semver version range syntax. Reads from pyproject.toml if unset.
default: ${{ null }}
required: false
python-version-file:
description: File containing the Python version to use.
default: pyproject.toml
required: false
token:
description: Used to pull python distributions from actions/python-versions. Since there's a default, this is typically not supplied by the user.
default: ${{ github.token }}
Expand All @@ -72,12 +77,28 @@ outputs:
runs:
using: composite
steps:
- id: composite-setup-python
- id: composite-setup-python-explicit
if: inputs.python-version != ''
uses: actions/setup-python@v5
with:
architecture: ${{ inputs.architecture }}
python-version: ${{ inputs.python-version }}
token: ${{ inputs.token }}
- id: composite-setup-python-file
if: inputs.python-version == ''
uses: actions/setup-python@v5
with:
architecture: ${{ inputs.architecture }}
python-version-file: ${{ inputs.python-version-file }}
token: ${{ inputs.token }}
- id: composite-setup-python
shell: bash
run: |
if [[ -n "${{ steps.composite-setup-python-explicit.outputs.python-version }}" ]]; then
echo "python-version=${{ steps.composite-setup-python-explicit.outputs.python-version }}" >> $GITHUB_OUTPUT ;
else
echo "python-version=${{ steps.composite-setup-python-file.outputs.python-version }}" >> $GITHUB_OUTPUT ;
fi
- id: composite-setup-poetry
uses: Gr1N/setup-poetry@v9
with:
Expand Down
Loading