diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index efcb3a1..787336f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 Python package" + 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 }}" @@ -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" + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7ff4a03..1a07087 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 }}" \ No newline at end of file + TWINE_PASSWORD: "${{ secrets.PYPI_API_TOKEN }}" \ No newline at end of file diff --git a/README.md b/README.md index f837037..fc6444f 100644 --- a/README.md +++ b/README.md @@ -77,16 +77,12 @@ 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 workflow](https://github.com/matrix-org/synapse-s3-storage-provider/actions/workflows/release.yml) will build the package and upload to [PyPI](https://pypi.org/project/synapse-s3-storage-provider/). -```shell -python -m build -twine check dist/* -twine upload dist/* -``` diff --git a/setup.py b/setup.py index cb9972f..9ad2c9a 100644 --- a/setup.py +++ b/setup.py @@ -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()