Skip to content

Commit

Permalink
enable reading python version from pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
ITProKyle committed Apr 3, 2024
1 parent 6a961a8 commit a9e3071
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 19 deletions.
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/[email protected]
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/[email protected]
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/[email protected]
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
9 changes: 7 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ 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.
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 @@ -77,6 +81,7 @@ runs:
with:
architecture: ${{ inputs.architecture }}
python-version: ${{ inputs.python-version }}
python-version-file: ${{ inputs.python-version-file }}
token: ${{ inputs.token }}
- id: composite-setup-poetry
uses: Gr1N/setup-poetry@v9
Expand Down
4 changes: 2 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license = "Apache-2.0"
package-mode = false

[tool.poetry.dependencies]
python = "^3.9"
python = "^3.12"

[tool.poetry.group.dev.dependencies]
pre-commit = "^3.7.0"
Expand Down

0 comments on commit a9e3071

Please sign in to comment.