name: pypi on: push: tags: - "*" env: DEFAULT_BRANCH: "main" jobs: build-and-deploy: name: Build and PyPI runs-on: ubuntu-latest steps: - name: check out uses: actions/checkout@v2 with: fetch-depth: 0 lfs: true - name: Setup Python uses: actions/setup-python@v2 with: python-version: 3.9 - name: Install Poetry uses: snok/install-poetry@v1 with: virtualenvs-create: true virtualenvs-in-project: true installer-parallel: true - name: Load cached venv id: cached-poetry-dependencies uses: actions/cache@v2 with: path: .venv key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/pyproject.toml') }} - name: Install dependencies if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' run: poetry install --no-interaction --no-root - name: Install library run: poetry install --no-interaction - name: Debugging information run: | source .venv/bin/activate echo "github.ref:" ${{github.ref}} echo "github.event_name:" ${{github.event_name}} echo "github.head_ref:" ${{github.head_ref}} echo "github.base_ref:" ${{github.base_ref}} set -x git rev-parse --abbrev-ref HEAD git branch git branch -a git remote -v python -V pip list --not-required pip list - name: Build run: poetry build - name: Deploy env: PYTHON_KEYRING_BACKEND: keyring.backends.null.Keyring POETRY_HTTP_BASIC_PYPI_USERNAME: __token__ POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ secrets.PYPI_TOKEN}} POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN}} run: poetry publish