pypi.yml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. name: publish fate_client to PyPI
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. source:
  6. description: 'source branch'
  7. required: true
  8. target:
  9. description: 'target package version'
  10. required: true
  11. type:
  12. description: 'publish type, test or release'
  13. required: false
  14. default: 'test'
  15. jobs:
  16. build:
  17. name: (${{github.event.inputs.type}} build) branch ${{github.event.inputs.source}} -> package version ${{github.event.inputs.target}}
  18. strategy:
  19. fail-fast: true
  20. runs-on: ubuntu-latest
  21. steps:
  22. - uses: actions/checkout@v2
  23. with:
  24. ref: ${{github.event.inputs.source}}
  25. - uses: actions/setup-python@v2
  26. with:
  27. python-version: 3.8
  28. - name: Prepare poetry
  29. uses: abatilo/actions-poetry@v2.0.0
  30. with:
  31. poetry-version: 1.1.6
  32. - name: Build fate_client
  33. run: |
  34. cd python/fate_client
  35. rm -f setup.py
  36. # clear README.rst
  37. echo "# fate client" > README.rst
  38. # bump fate client version
  39. poetry version ${{github.event.inputs.target}}
  40. # build package, saved in dist/
  41. poetry build
  42. - name: List dist files
  43. run: ls -lh python/fate_client/dist/ python/fate_client/dist/
  44. - name: Twine check
  45. run: |
  46. pip install -U twine
  47. twine check python/fate_client/dist/*
  48. - name: Upload to artifact
  49. uses: actions/upload-artifact@v2
  50. with:
  51. path: |
  52. python/fate_client/dist/*
  53. - name: Test Install
  54. run: |
  55. pip install -U pip
  56. pip install python/fate_client/dist/fate_client-${{github.event.inputs.target}}.tar.gz
  57. - name: Upload to PyPI Test
  58. if: ${{ github.event.inputs.type == 'test' }}
  59. run: |
  60. twine upload --repository testpypi python/fate_client/dist/* --verbose
  61. env:
  62. TWINE_USERNAME: __token__
  63. TWINE_PASSWORD: ${{ secrets.pypitest_token }}
  64. - name: Upload to PyPI
  65. if: ${{ github.event.inputs.type == 'release' }}
  66. run: |
  67. twine upload python/fate_client/dist/* --verbose
  68. env:
  69. TWINE_USERNAME: __token__
  70. TWINE_PASSWORD: ${{ secrets.pypi_token }}