diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.yml new file mode 100644 index 00000000..d6c8e73a --- /dev/null +++ b/.github/workflows/pypi-release.yml @@ -0,0 +1,24 @@ +name: PyPI-Release + +on: + push: + branches: + - master + +jobs: + build-and-publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: "3.x" + - name: Install build dependencies + run: pip install -U setuptools wheel build + - name: Build + run: python -m build . + - name: Publish + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.pypi_password }} diff --git a/README.md b/README.md index 7caac568..96d3bfe2 100644 --- a/README.md +++ b/README.md @@ -131,3 +131,5 @@ e.g. pip install tox tox -e reformat ``` + +For information on releasing version bumps see [RELEASING.md](RELEASING.md) diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 00000000..f368b3ed --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,17 @@ +# Releasing CloudEvents SDK for Python + +This repository is configured to automatically publish the corresponding [PyPI +package](https://pypi.org/project/cloudevents/) via GitHub Actions. + +To release a new CloudEvents SDK, contributors should bump the `version` in +[setup.py](setup.py)) to reflect the new release version. On merge, the action +will automatically build and release to PyPI using +[this PyPI GitHub Action](https://github.com/pypa/gh-action-pypi-publish). This +action gets called on all pushes to master (such as a version branch being merged +into master), but only releases a new version when the version number has changed. + +After a version update is merged, maintainers are expected to manually create a +corresponding tag/release. + +View the GitHub workflow [pypi-release.yml](.github/workflows/pypi-release.yml) for +more information. diff --git a/release.sh b/release.sh deleted file mode 100644 index 8d276b9c..00000000 --- a/release.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash - -# Fail fast and fail hard. -set -eo pipefail - -# Check for our version -if [ -z "$CLOUDEVENTS_SDK_VERSION" ]; then - echo "Need to set CLOUDEVENTS_SDK_VERSION" - exit 1 -fi - -# Run tests on target branch -tox - -# Cut off stable branch -git checkout -b v${CLOUDEVENTS_SDK_VERSION}-stable - -# Create GitHub tag -git tag -a ${CLOUDEVENTS_SDK_VERSION} -m "${CLOUDEVENTS_SDK_VERSION}" - -# Build distribution package -rm -rf dist -pip install -U setuptools wheel -python setup.py sdist bdist_wheel - -# Submit relase to PyPI -pip install -U twine -twine upload dist/* - -# Push the release to GitHub -git push origin v${CLOUDEVENTS_SDK_VERSION}-stable -git push --tags - -# Switch back to the master branch -git checkout master diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index e01208e8..00000000 --- a/setup.cfg +++ /dev/null @@ -1,29 +0,0 @@ -[metadata] -name = cloudevents -summary = CloudEvents SDK Python -description-file = - README.md -long-description-content-type = text/markdown -author = Denis Makogon -author-email = denys.makogon@oracle.com -home-page = https://cloudevents.io/ -classifier = - Intended Audience :: Information Technology - Intended Audience :: System Administrators - License :: OSI Approved :: Apache Software License - Operating System :: POSIX :: Linux - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - -[files] -packages = - cloudevents - -[global] -setup-hooks = - pbr.hooks.setup_hook - -[pbr] -skip_changelog = True diff --git a/setup.py b/setup.py index 93335285..7dcb8ed2 100644 --- a/setup.py +++ b/setup.py @@ -14,5 +14,31 @@ import setuptools +import pathlib -setuptools.setup(setup_requires=["pbr>=2.0.0"], pbr=True) + +here = pathlib.Path(__file__).parent.resolve() +long_description = (here / "README.md").read_text(encoding="utf-8") + +setuptools.setup( + name="cloudevents", + summary="CloudEvents SDK Python", + long_description_content_type="text/markdown", + long_description=long_description, + author="The Cloud Events Contributors", + author_email="cncfcloudevents@gmail.com", + home_page="https://cloudevents.io", + classifiers=[ + "Intended Audience :: Information Technology", + "Intended Audience :: System Administrators", + "License :: OSI Approved :: Apache Software License", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + ], + package_dir={"": "cloudevents"}, + packages=["http", "sdk"], + version="1.0.0", +)