diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 4b37aaf..fdd31cd 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -6,37 +6,45 @@ # separate terms of service, privacy policy, and support # documentation. -name: Publish to PyPI +name: Publish Python Package on: push: - branches: - - main + tags: + - 'v*.*.*' jobs: build: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v3 + - name: Check out repository + uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: '3.x' + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine + - name: Install Poetry + run: curl -sSL https://install.python-poetry.org | python3 - - - name: Build package - run: python setup.py sdist bdist_wheel + - name: Configure Poetry + run: | + poetry config virtualenvs.in-project true + + - name: Install dependencies + run: | + poetry install + + - name: Build package + run: | + poetry build + + - name: Publish package to PyPI + env: + POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }} + run: | + poetry publish --no-interaction --username __token__ --password ${{ secrets.PYPI_API_TOKEN }} - - name: Publish package to PyPI - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: twine upload dist/*