diff --git a/README.md b/README.md new file mode 100644 index 0000000..06d5d9b --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# Github Action: pypi-build-publish + +Github action to build and publish to PyPI [PEP 518](https://www.python.org/dev/peps/pep-0518/) compliant projects (flit, poetry,...). + +Usage: + +```yaml +- use: conchylicultor/pypi-build-publish@v1 + with: + pypi-token: ${{ secrets.PYPI_API_TOKEN }} +``` + +The action assume: + +* The project has a `pyproject.toml` (or `setup.py`) in the top-level directory. +* Python and pip are installed (e.g. by `actions/setup-python@v2`). + +## Inputs + +* `pypi-token`: The PyPI API token to use. (required) + +## Outputs + +None. diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..cb6821b --- /dev/null +++ b/action.yml @@ -0,0 +1,26 @@ +name: 'Build & Publish to PyPI' +author: 'Conchylicultor' +description: 'Build and publish to PyPI for PEP 518 compliant projects (flit, poetry,...).' +branding: + icon: upload-cloud + color: orange + +inputs: + pypi-token: + description: 'Token of the PyPI account publishing the project.' + required: true + +runs: + using: "composite" + steps: + - run: pip install build twine + shell: bash + - run: python -m build + shell: bash + - run: twine check dist/* + shell: bash + - run: twine upload dist/* + shell: bash + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ inputs.pypi-token }}