.github/workflows/publish.yml
name: Publish package
on:
workflow_run:
workflows:
- Test
types:
- completed
branches:
- master
jobs:
publish:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.event == 'push' && github.event.workflow_run.conclusion == 'success' }}
env:
python_version: "3.8"
poetry_version: 1.1.14
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.python_version }}
- name: Cache poetry
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-${{ env.python_version }}-${{ runner.os }}-${{ env.poetry_version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: ${{ env.poetry_version }}
virtualenvs-create: true
virtualenvs-in-project: true
- run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
poetry build
poetry publish