Skip to content

Commit

Permalink
Wrote pypi upload process using python.
Browse files Browse the repository at this point in the history
  • Loading branch information
mush42 committed Feb 2, 2021
1 parent d7aa838 commit b95a254
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
9 changes: 3 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 10 additions & 0 deletions tasks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# coding: utf-8

import os
import struct
from pathlib import Path
from invoke import task
Expand Down Expand Up @@ -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')

0 comments on commit b95a254

Please sign in to comment.