diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..3944bfe --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,11 @@ +stages: + - package + +publish-pypi: + stage: package + image: python:3.8 + script: + - pip install -U setuptools wheel pip; pip install invoke + - invoke upload --pypi-user ${PYPI_REPO_USER} --pypi-password ${PYPI_REPO_PASSWORD} --pypi_url ${PYPI_REPO_URL} + only: + - tags diff --git a/tasks.py b/tasks.py index 96bf572..205fe89 100644 --- a/tasks.py +++ b/tasks.py @@ -156,7 +156,7 @@ def prepare_upload(c): @task(tag_eq_version, prepare_upload) -def upload(c, pypi_user=None, pypi_password=None): +def upload(c, pypi_user=None, pypi_password=None, pypi_url=None): """ Upload on pypi """ @@ -165,8 +165,9 @@ def upload(c, pypi_user=None, pypi_password=None): if pypi_user is not None and pypi_password is not None: c.run( f"dist_venv/bin/twine upload --non-interactive" - f" -u {pypi_user} -p {pypi_password} {dist}", + f" -u {pypi_user} -p {pypi_password} {dist}" + f" --repository-url {pypi_url}", hide=True, ) else: - c.run(f"dist_venv/bin/twine upload --repository aiohttp-pydantic {dist}") + c.run(f"dist_venv/bin/twine upload --repository-url {pypi_url} --repository aiohttp-pydantic {dist}")