|
1 |
| -# pypi-github-sync |
| 1 | +# pypi-github-sync [](https://github.com/PabloLec/pypi-github-sync/releases/) [](https://github.com/PabloLec/pypi-github-sync/blob/main/LICENCE) |
| 2 | + |
| 3 | +This action allows you to upload your Python distribution package to PyPI automatically using latest GitHub version tag as release version. |
| 4 | + |
| 5 | +## How does it work? |
| 6 | + |
| 7 | +Running a Docker container, this action will clone your repo, fetch its latest release tag, modify `setup.py`, build and finally push to PyPI. |
| 8 | + |
| 9 | +It currently only support `setup.py`, see [Contributing](#Contributing) if you want other supported formats. |
| 10 | + |
| 11 | +Also, with current procedure your GitHub repo remains untouched. That means the version parameter in `setup.py` will not be modified and its value does not matter. |
| 12 | +You can leave a dummy value, for example: |
| 13 | +``` Python |
| 14 | +setup( |
| 15 | + version="0.0.0", |
| 16 | + ... |
| 17 | +) |
| 18 | +``` |
| 19 | + |
| 20 | + |
| 21 | +## Usage |
| 22 | + |
| 23 | +In your GitHub repo, create a workflow file or append to an existing one. (e.g. `.github/workflows/release.yml`) |
| 24 | + |
| 25 | +Mandatory parameters are: |
| 26 | +``` yaml |
| 27 | +- name: pypi-github-sync |
| 28 | + |
| 29 | + with: |
| 30 | + github_repo: YOUR_USERNAME/YOUR_REPO |
| 31 | + twine_username: ${{ secrets.TWINE_USERNAME }} |
| 32 | + twine_password: ${{ secrets.TWINE_PASSWORD }} |
| 33 | +``` |
| 34 | +
|
| 35 | +You will need to change `YOUR_USERNAME` and `YOUR_REPO` values and set your PyPI username and password in your repository secrets ([See the docs for reference](https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository)). |
| 36 | + |
| 37 | +See [EXAMPLE.yml](EXAMPLE.yml) for a real world example. |
| 38 | + |
| 39 | +## Inputs |
| 40 | + |
| 41 | +#### `github_repo` *mandatory* |
| 42 | + |
| 43 | +Your github repository with format `USERNAME/REPO` as in URLs. For example this repo is `PabloLec/pypi-github-sync`. |
| 44 | + |
| 45 | +#### `twine_username` *mandatory* |
| 46 | + |
| 47 | +Your PyPI username, add it to your [repository secrets](https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository). |
| 48 | + |
| 49 | +#### `twine_password` *mandatory* |
| 50 | + |
| 51 | +Your PyPI password, add it to your [repository secrets](https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository). |
| 52 | + |
| 53 | +#### `upload_repo` *optional* |
| 54 | + |
| 55 | +The repository used for package uploading. Defaults to main PyPI repo, you can use others like PyPI test repo with `'https://test.pypi.org/legacy/'`. |
| 56 | + |
| 57 | +#### `verify_metadata` *optional* |
| 58 | + |
| 59 | +Verify build metadata before publication, defaults to false. |
| 60 | + |
| 61 | +#### `skip_existing` *optional* |
| 62 | + |
| 63 | +Do not raise an error if version already exists on repo, defaults to false. |
| 64 | + |
| 65 | +#### `verbose` *optional* |
| 66 | + |
| 67 | +Verbose output for twine upload, defaults to false. |
| 68 | + |
| 69 | +## Contributing |
| 70 | + |
| 71 | +Any contribution is welcome. |
| 72 | +To report a bug or offer your help, simply open a new [issue](issues). |
| 73 | +You can also open an issue if you want a new feature to be implemented. |
0 commit comments