Skip to content

chore: publish v0.3.0 #31

chore: publish v0.3.0

chore: publish v0.3.0 #31

Workflow file for this run

name: Publish to PyPI
on:
push:
branches: ["*"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
shell: bash
- name: Configure Poetry to use virtual environment inside the project
run: poetry config virtualenvs.in-project true
- name: Install dependencies
run: poetry install
- name: Run Tests
run: poetry run pytest
- name: Build the package
run: poetry build
- name: Get current version from pyproject.toml
id: get_version
run: echo "VERSION=$(poetry version -s)" >> $GITHUB_ENV
- name: Check last version on PyPI
id: check_pypi_version
run: |
LAST_VERSION=$(curl -s https://pypi.org/pypi/<your-package-name>/json | jq -r .info.version)
echo "LAST_VERSION=$LAST_VERSION" >> $GITHUB_ENV
- name: Publish to PyPI (release only)
if: env.VERSION != env.LAST_VERSION
run: poetry publish --no-interaction --username __token__ --password ${{ secrets.PYPI_TOKEN }}