From b95a25438a4715a0b177abc2e36d8871fc8e5863 Mon Sep 17 00:00:00 2001 From: mush42 Date: Tue, 2 Feb 2021 20:51:20 +0200 Subject: [PATCH] Wrote pypi upload process using python. --- appveyor.yml | 9 +++------ tasks.py | 10 ++++++++++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index df206bb..5a9c2e9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -56,9 +56,6 @@ artifacts: - path: target\wheels\*.whl on_success: - - ps: | - if ($env:APPVEYOR_REPO_TAG_NAME -and $env:APPVEYOR_REPO_TAG_NAME.StartsWith("release-")) { - .venv\Scripts\activate.ps1 - python -m pip install twine - twine upload ".\target\wheels\*" --non-interactive --skip-existing - } + - echo "Initializing upload script..." + - python -m pip install twine + - invoke upload-wheels diff --git a/tasks.py b/tasks.py index 12929fa..5c28f97 100644 --- a/tasks.py +++ b/tasks.py @@ -1,5 +1,6 @@ # coding: utf-8 +import os import struct from pathlib import Path from invoke import task @@ -27,3 +28,12 @@ def build_wheels(c): pythons = [Path(pypath, "python.exe").resolve() for pypath in PYTHON_TARGETS[ARCH]] i_arg = " -i ".join(f'"{str(py)}"' for py in pythons) c.run(f"maturin build --release -i {i_arg}") + + +@task +def upload_wheels(c): + tag_triggered = os.environ.get('APPVEYOR_REPO_TAG_NAME', "").startswith("release") + if not tag_triggered: + return print("Not a release build.\nSkipping PyPI upload process.") + with c.cd(REPO_HOME): + c.run('twine upload ".\target\wheels\*" --non-interactive --skip-existing')