publish-single-package.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. name: Publish a taipy package on Pypi
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. version:
  6. description: "The tag of the package to publish on Pypi (ex: 1.0.0, 1.0.0.dev0)"
  7. required: true
  8. target_package:
  9. description: "The package to be released (gui, common, core, rest, templates, taipy)"
  10. required: true
  11. jobs:
  12. publish-package-to-pypi:
  13. permissions:
  14. id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
  15. timeout-minutes: 20
  16. environment: publish
  17. runs-on: ubuntu-latest
  18. steps:
  19. - uses: actions/checkout@v4
  20. with:
  21. sparse-checkout: taipy/${{ matrix.package }}
  22. sparse-checkout-cone-mode: false
  23. - name: Checks if package is already on Pypi
  24. id: check-version
  25. run: |
  26. if curl https://pypi.org/simple/taipy-${{ github.event.inputs.target_package }}} | grep -o ">taipy-${{ github.event.inputs.target_package }}}-${{ github.event.inputs.version }}\.tar\.gz<"; then
  27. echo "exists=true" >> $GITHUB_OUTPUT
  28. else
  29. echo "exists=false" >> $GITHUB_OUTPUT
  30. fi
  31. - name: Download assets from tag
  32. if: steps.check-version.outputs.exists == 'false'
  33. run: |
  34. gh release download ${{ github.event.inputs.version }}-${{ github.event.inputs.target_package }} --dir dist
  35. env:
  36. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  37. - name: Publish to PyPI
  38. if: steps.check-version.outputs.exists == 'false'
  39. uses: pypa/gh-action-pypi-publish@release/v1