diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..ccd6a7be --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +name: Publish packages to PyPI + +on: + push: + tags: + - "[0-9]+.[0-9]+.[0-9]+" + - "[0-9]+.[0-9]+.[0-9]+.post[0-9]+" + - "[0-9]+.[0-9]+.[0-9]+[a-b][0-9]+" + - "[0-9]+.[0-9]+.[0-9]+rc[0-9]+" + +jobs: + build: + runs-on: ubuntu-latest + environment: release + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.x + - name: Install dependencies + run: pip install build + - name: Create packages + run: python -m build . + - name: Store package artifacts + uses: actions/upload-artifact@v3 + with: + name: dist + path: dist + + publish: + needs: build + runs-on: ubuntu-latest + environment: release + permissions: + id-token: write + steps: + - name: Retrieve package artifacts + uses: actions/download-artifact@v3 + - name: Upload packages + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/RELEASE.rst b/RELEASE.rst index ad944a11..e2772206 100644 --- a/RELEASE.rst +++ b/RELEASE.rst @@ -33,7 +33,7 @@ and a `source distribution .dev0`` in ``motor/_version.py``, + commit, then push. - $ git clone git@github.com:mongodb/motor.git - $ cd motor - $ git checkout "" - $ ./release.sh - - This will create the following distributions:: - - $ ls dist - motor-.tar.gz - motor--py3-none-any.whl - -#. Upload all the release packages to PyPI with twine:: - - $ python3 -m twine upload dist/* +#. Authorize the deployment for the tagged version on the release GitHub Action and + wait for it to successfully publish to PyPI. #. Make sure the new version appears on https://motor.readthedocs.io/. If the new version does not show up automatically, trigger a rebuild of "latest": https://readthedocs.org/projects/motor/builds/ -#. Bump the version number to .dev0 in motor/_version.py, - commit, push. - -#. Publish the release version in Jira. +#. Publish the release version in Jira and add a brief description about the reason + for the release or the main feature. #. Announce the release on: https://www.mongodb.com/community/forums/c/announcements/driver-releases