python-package.yml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. tags:
  7. - '*released'
  8. workflow_dispatch:
  9. jobs:
  10. build:
  11. runs-on: ubuntu-latest
  12. strategy:
  13. fail-fast: false
  14. matrix:
  15. python-version: ["3.10"]
  16. steps:
  17. - name: Checkout code
  18. uses: actions/checkout@v4
  19. with:
  20. fetch-depth: 0
  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 }}
  59. # - name: Publish to PyPI
  60. # uses: pypa/gh-action-pypi-publish@release/v1
  61. # with:
  62. # user: __token__
  63. # password: ${{ secrets.PYPI_TOKEN }}