Skip to content

Merge pull request #207 from Impelon/patch-2 #15

Merge pull request #207 from Impelon/patch-2

Merge pull request #207 from Impelon/patch-2 #15

Workflow file for this run

name: Publish new release on PyPI
# workflow is triggered when a new release is created or a new git tag is pushed to this repository
# and it can be manually triggered
on:
workflow_dispatch:
release:
types: [created]
push:
tags:
- '*'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# downloads the repository code to the runner's file system for workflow access
- uses: actions/checkout@v4
- name: Fetch all history for all tags and branches
run: git fetch --prune --unshallow
# sets up python environment with specified versions
- name: Set up python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: 3.8
# installs poetry and configures it
- name: Install poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
# loads cached venv if it exists
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ steps.setup-python.outputs.python-version }}
# automatic version numbering
- name: Install poetry dynamic version plugin, extracts version number from git tag
run: |
pip install poetry-version-plugin
poetry self add poetry-version-plugin
# build package
- name: Build package out of local poject
run: poetry build
# publish package to pypi
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}