autoci.yml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. name: auto CI
  2. on:
  3. push:
  4. branches: [ master ]
  5. pull_request:
  6. branches: [ master ]
  7. schedule:
  8. - cron: "0 2 * * 1-5"
  9. env:
  10. POETRY_VERSION: 1.8.3
  11. PYTHON_VERSION: "3.12"
  12. jobs:
  13. build:
  14. strategy:
  15. matrix:
  16. os: [ubuntu-latest, macos-latest, windows-latest]
  17. include:
  18. - os: ubuntu-latest
  19. path: ~/.cache/pip
  20. - os: macos-latest
  21. path: ~/Library/Caches/pip
  22. - os: windows-latest
  23. path: ~\AppData\Local\pip\Cache
  24. runs-on: ubuntu-latest
  25. steps:
  26. - uses: actions/checkout@v4
  27. - name: Set up Python
  28. id: setup-python
  29. uses: actions/setup-python@v5
  30. with:
  31. python-version: ${{ env.PYTHON_VERSION }}
  32. - name: Install Poetry ${{ env.POETRY_VERSION }}
  33. uses: abatilo/actions-poetry@v3.0.0
  34. with:
  35. poetry-version: ${{ env.POETRY_VERSION }}
  36. - uses: actions/cache@v2
  37. with:
  38. path: ${{ matrix.path }}
  39. key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
  40. restore-keys: |
  41. ${{ runner.os }}-pip-
  42. - uses: actions/cache@v2
  43. with:
  44. path: ~/.local/share/virtualenvs
  45. key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-pipenv-${{ hashFiles('Pipfile.lock') }}
  46. - name: Install dependencies
  47. run: |
  48. python -m pip install --upgrade pip
  49. if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
  50. - name: Update Deny Host
  51. run: |
  52. pwd
  53. python cmd/refresh.py
  54. - name: Push to built branch
  55. uses: Automattic/action-commit-to-branch@master
  56. with:
  57. branch: 'master'
  58. commit_message: 'Update Host'
  59. env:
  60. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  61. - name: Publish distribution 📦 to Test PyPI
  62. uses: pypa/gh-action-pypi-publish@master
  63. with:
  64. user: __token__
  65. password: ${{ secrets.test_pypi_password }}
  66. repository_url: https://test.pypi.org/legacy/
  67. - name: Publish distribution 📦 to PyPI
  68. if: startsWith(github.event.ref, 'refs/tags')
  69. uses: pypa/gh-action-pypi-publish@master
  70. with:
  71. user: __token__
  72. password: ${{ secrets.pypi_password }}