python-package.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
  2. # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
  3. name: Python package
  4. on:
  5. push:
  6. branches: [ "master" ]
  7. tags:
  8. - 'released'
  9. pull_request:
  10. branches: [ "master" ]
  11. workflow_dispatch:
  12. jobs:
  13. build:
  14. runs-on: ubuntu-latest
  15. strategy:
  16. fail-fast: false
  17. matrix:
  18. python-version: ["3.10"]
  19. steps:
  20. - uses: actions/checkout@v4
  21. - name: Set up Python ${{ matrix.python-version }}
  22. uses: actions/setup-python@v5
  23. with:
  24. python-version: ${{ matrix.python-version }}
  25. - name: Install dependencies
  26. run: |
  27. python -m pip install --upgrade pip
  28. if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
  29. - name: Install wheel
  30. run: |
  31. python -m pip install wheel
  32. - name: Build wheel
  33. run: |
  34. python setup.py bdist_wheel
  35. - name: Upload artifact
  36. uses: actions/upload-artifact@v4
  37. with:
  38. name: wheel-file
  39. path: dist/*.whl
  40. retention-days: 30
  41. release:
  42. needs: [ build ]
  43. runs-on: ubuntu-latest
  44. steps:
  45. - name: Checkout code
  46. uses: actions/checkout@v4
  47. - name: Download artifact
  48. uses: actions/download-artifact@v4
  49. with:
  50. name: wheel-file
  51. path: dist
  52. - name: Create and Upload Release
  53. id: create_release
  54. uses: softprops/action-gh-release@4634c16e79c963813287e889244c50009e7f0981
  55. with:
  56. files: './dist/*.whl'
  57. env:
  58. GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}