|
8 | 8 | name: Build and publish package to PyPI |
9 | 9 | runs-on: ubuntu-18.04 |
10 | 10 | steps: |
11 | | - - uses: actions/checkout@master |
12 | | - - name: Set up Python 3.7 |
| 11 | + - uses: actions/checkout@v2 |
| 12 | + - name: Set up Python |
13 | 13 | uses: actions/setup-python@v1 |
14 | 14 | with: |
15 | | - python-version: 3.7 |
16 | | - - name: Install wheel |
17 | | - run: python3 -m pip install --user --upgrade setuptools wheel |
18 | | - - name: Build a binary wheel and a source tarball |
19 | | - run: python3 setup.py sdist bdist_wheel |
20 | | - - name: Publish distribution to PyPI |
21 | | - if: startsWith(github.ref, 'refs/tags') |
22 | | - uses: pypa/gh-action-pypi-publish@master |
| 15 | + python-version: "3.7" |
| 16 | + - name: Install poetry |
| 17 | + run: | |
| 18 | + curl -fsS -o get-poetry.py https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py |
| 19 | + python get-poetry.py -y |
| 20 | + - name: Configure poetry |
| 21 | + run: $HOME/.poetry/bin/poetry config virtualenvs.in-project true |
| 22 | + - name: Set up cache |
| 23 | + uses: actions/cache@v1 |
| 24 | + id: cache |
23 | 25 | with: |
24 | | - password: ${{ secrets.pypi_password }} |
| 26 | + path: .venv |
| 27 | + key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} |
| 28 | + - name: Ensure cache is healthy |
| 29 | + if: steps.cache.outputs.cache-hit == 'true' |
| 30 | + run: $HOME/.poetry/bin/poetry run pip --version >/dev/null 2>&1 || rm -rf .venv |
| 31 | + - name: Install Dependencies |
| 32 | + run: $HOME/.poetry/bin/poetry install |
| 33 | + - name: Publish |
| 34 | + env: |
| 35 | + PYPI_TOKEN: ${{ secrets.pypi_password }} |
| 36 | + run: | |
| 37 | + $HOME/.poetry/bin/poetry config pypi-token.pypi $PYPI_TOKEN |
| 38 | + $HOME/.poetry/bin/poetry publish --build |
0 commit comments