name: Publish on PyPI on: workflow_call: inputs: pyver: description: 'Python version.' required: false default: '3.10' type: string artifact: description: 'Name of the wheel artifact.' required: true type: string secrets: PYPI_TOKEN: description: "Token for pushing releases to PyPI" required: false jobs: PublishOnPyPI: name: ๐Ÿš€ Publish to PyPI runs-on: ubuntu-latest steps: - name: ๐Ÿ“ฅ Download artifacts '${{ inputs.artifact }}' from 'Package' job uses: actions/download-artifact@v2 with: name: ${{ inputs.artifact }} path: dist/ - name: ๐Ÿ Setup Python ${{ inputs.pyver }} uses: actions/setup-python@v2 with: python-version: ${{ inputs.pyver }} - name: โš™ Install dependencies for packaging and release run: | python -m pip install --upgrade pip pip install wheel twine - name: โคด Release Python package to PyPI env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} run: | twine upload dist/* - name: ๐Ÿ—‘๏ธ Delete packaging Artifacts uses: geekyeggo/delete-artifact@v1 with: name: ${{ inputs.artifact }}