python.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. name: auto CI
  2. on:
  3. push:
  4. branches: [ master ]
  5. pull_request:
  6. branches: [ master ]
  7. jobs:
  8. build:
  9. strategy:
  10. matrix:
  11. os: [ubuntu-latest]
  12. include:
  13. - os: ubuntu-latest
  14. path: ~/.cache/pip
  15. - os: macos-latest
  16. path: ~/Library/Caches/pip
  17. - os: windows-latest
  18. path: ~\AppData\Local\pip\Cache
  19. runs-on: ubuntu-latest
  20. steps:
  21. - uses: actions/checkout@v2
  22. - name: Set up Python 3.8
  23. id: setup-python
  24. uses: actions/setup-python@v2
  25. with:
  26. python-version: 3.8
  27. - uses: actions/cache@v2
  28. with:
  29. path: ${{ matrix.path }}
  30. key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
  31. restore-keys: |
  32. ${{ runner.os }}-pip-
  33. - uses: actions/cache@v2
  34. with:
  35. path: ~/.local/share/virtualenvs
  36. key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-pipenv-${{ hashFiles('Pipfile.lock') }}
  37. - name: Install dependencies
  38. run: |
  39. python -m pip install --upgrade pip
  40. if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
  41. - name: Publish distribution 📦 to Test PyPI
  42. uses: pypa/gh-action-pypi-publish@master
  43. with:
  44. user: __token__
  45. password: ${{ secrets.test_pypi_password }}
  46. repository_url: https://test.pypi.org/legacy/
  47. - name: Publish distribution 📦 to PyPI
  48. if: startsWith(github.event.ref, 'refs/tags')
  49. uses: pypa/gh-action-pypi-publish@master
  50. with:
  51. user: __token__
  52. password: ${{ secrets.pypi_password }}