Update and rename python-app.yml to python-deploy.yml #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python Poetry CI | |
on: | |
push: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
test-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.10.14 | |
- name: Install Poetry | |
run: python -m pip install poetry==1.8.2 | |
- name: Cache virtualenv | |
uses: actions/cache@v4 | |
with: | |
path: ./.venv | |
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
run: python -m poetry install | |
- name: Run tests with pytest | |
run: python -m poetry run python -m pytest -v | |
- run: poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }} | |
- name: Build and publish to PyPI | |
run: poetry publish --build | |