pypi-publisher is a GitHub action designed to upload python projects to Pypi repository.
- In your GitHub repository, select the Actions tab and either add or edit a workflow.
- Navigate to
pypi-publisherin Marketplace. - Copy and paste the yaml into your workflow.
[OR]
Copy & paste the following workflow definition into your project .github/workflows/pypi-publish.yml
name: PyPi Publisher
on:
workflow_dispatch:
release:
types: [ published ]
jobs:
pypi-publisher:
runs-on: ubuntu-latest
steps:
- uses: thevickypedia/pypi-publisher@v3
id: publish
env:
token: ${{ secrets.PYPI_TOKEN }}
with:
skip-existing: true
- run: |
echo "✅ Published project: ${{ steps.publish.outputs.name }}"
echo "📦 Version: ${{ steps.publish.outputs.version }}"| Parameter | Description | Default |
|---|---|---|
user |
PyPi username. | __token__ |
token |
PyPi token. [Mandatory] | NA |
test-upload |
Uploads to TestPyPi repository. | false |
dry-run |
Builds the distribution without uploading to PyPi. | false |
repository-url |
PyPi repository URL. | upload.pypi.org** |
packages-dir |
The target directory for distribution. | dist |
verify-metadata |
Check metadata before uploading. | true |
skip-existing |
Avoids failing if distribution exists in package index. | true |
verbose |
Runs in verbose mode. | false |
print-hash |
Show hash values of distribution files. | true |
setup-python |
Uses the GH action setup-python. |
false** |
python-version |
Python version for setup-python. |
3.9 |
Notes
repository-urldefaults to upload.pypi.org, but it can change dynamically based on thetest-uploadflag.setup-pythondefaults tofalse, but it can change dynamically based on whetherpythonis installed in the runner.python-versionwill be used only whensetup-pythonflag is set totrue, otherwise the defaultpythonin the runner takes precedence.
Only
userandtokencan be passed asenvwhilst, rest of the parameters should be passed usingwith
© Vignesh Rao
Licensed under the MIT License