Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOTOR-1219 Use PyPI Trusted Publishing #240

Merged
merged 2 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
28 changes: 7 additions & 21 deletions RELEASE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ and a `source distribution <https://packaging.python.org/guides/distributing-pac
the git log, but you might add some more long form notes for big changes.

#. Replace the ``devN`` version number w/ the new version number (see
note above in `Versioning`_). Make sure version number is updated in
note above in `Versioning`_) in
``motor/_version.py``. Commit the change and tag the release.
Immediately bump the version number to ``dev0`` in a new commit::

Expand All @@ -45,32 +45,18 @@ and a `source distribution <https://packaging.python.org/guides/distributing-pac
$ git push
$ git push --tags

#. Build the release packages by running the ``release.sh``
script on macOS::
#. Bump the version number to ``<next version>.dev0`` in ``motor/_version.py``,
commit, then push.

$ git clone git@github.com:mongodb/motor.git
$ cd motor
$ git checkout "<release version number>"
$ ./release.sh

This will create the following distributions::

$ ls dist
motor-<version>.tar.gz
motor-<version>-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 <next version>.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
Expand Down
Loading