Skip to content

Publish to PyPI

Publish to PyPI #7

Workflow file for this run

name: Publish to PyPI
on:
push:
branches: [ main ]
paths:
- "version"
workflow_dispatch: {}
jobs:
build-n-publish:
name: Publish to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Cache Poetry
uses: actions/cache@v2
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install dependencies
run: poetry install
- name: Build and Publish
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
version=$(cat version)
poetry version ${version}
poetry build
poetry publish