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

Make the release action upload to real PyPI #70

Merged
merged 13 commits into from
Dec 1, 2021
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,29 @@ jobs:
- name: "Run tox lint targets for ${{ matrix.python-version }}"
run: "python -m tox -e check_isort,pep8,packaging"

build:
# This is similar to the job in `release.yml`, but it does NOT upload to PyPI.
# We include it here to reduce the likelihood of someone publishing a release
# which doesn't build.
name: "Build and check package"
DMRobertson marked this conversation as resolved.
Show resolved Hide resolved
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"

- uses: "actions/setup-python@v2"
with:
python-version: "3.6"

- name: "Install packaging tools"
run: "python -m pip install --upgrade build twine"

- name: "Build dist package"
run: "python -m build"

- name: "Run twine checks"
run: "python -m twine check dist/*"


tests:
needs: lint
name: "Python ${{ matrix.python-version }}"
Expand All @@ -55,3 +78,4 @@ jobs:
python -m pip install --upgrade tox
- name: "Run tox targets for ${{ matrix.python-version }}"
run: "python -m tox -e py"

4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
run: "python -m build"

- name: "Upload to PyPI"
run: "python -m twine upload --repository testpypi dist/*"
run: "python -m twine upload dist/*"
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: "${{ secrets.TESTPYPI_API_TOKEN }}"
TWINE_PASSWORD: "${{ secrets.PYPI_API_TOKEN }}"
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,13 @@ Updated 0 as deleted
# prepare to wait a long time
```

Packaging
Packaging and release
---------

For maintainers:

1. Update the `__version__` in setup.py.
2. Build, check and upload to PyPI as follows:
1. Update the `__version__` in setup.py. Commit. Push.
2. Create a release on GitHub for this version.
3. When published, a [GitHub action](https://github.com/matrix-org/synapse-s3-storage-provider/runs/4312656424?check_suite_focus=true) will build the package and upload to [PyPI](https://pypi.org/project/synapse-s3-storage-provider/).
DMRobertson marked this conversation as resolved.
Show resolved Hide resolved

```shell
python -m build
twine check dist/*
twine upload dist/*
```
**NB.** `matrix.org` is currently configured to `git checkout` this module directly and does NOT pull from PyPI.
DMRobertson marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup

__version__ = "1.1.1-test"
__version__ = "1.1" # Bump to a 3-part semver for next version, i.e. 1.1.1

with open("README.md") as f:
long_description = f.read()
Expand Down