Skip to content

Commit

Permalink
upload version (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonz5288 committed Nov 16, 2021
1 parent d1cdb0e commit a62dce5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@ jobs:
- name: Upload PyPI
env:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets#using-encrypted-secrets-in-a-workflow
PROD_PWD: ${{ secrets.PYPI_PWD_PROD }}
PROD_PWD: 'asdfasdf'
NIGHT_PWD: ${{ secrets.PYPI_PWD_NIGHTLY }}
PROJECT_NAME: ${{ matrix.name }}
PYTHON: ${{ matrix.python }}
USERNAME: ${{ secrets.METADATA_USERNAME }}
PASSWORD: ${{ secrets.METADATA_PASSWORD }}
run: |
mkdir dist
cp wheel/*.whl dist/
Expand Down
12 changes: 12 additions & 0 deletions python/build.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import argparse
import os
import requests
import platform
import re
import shutil
Expand Down Expand Up @@ -81,6 +82,15 @@ def parse_args():
help='Set the project name')
return parser.parse_args()

def upload_taichi_version():
username = os.getenv('USERNAME')
password = os.getenv('PASSWORD')
filename = os.listdir('../dist')[0]
filename = filename[:len(filename)-4]
parts = filename.split('-')
payload = {'version': parts[1], 'platform': parts[4], 'python': parts[2]}
response = requests.post('http://54.90.48.192/add_version/detail', json=payload, auth=requests.auth.HTTPBasicAuth(username, password))
print(response.text)

def main():
args = parse_args()
Expand Down Expand Up @@ -115,6 +125,8 @@ def main():
if mode == 'build':
return
elif mode == 'upload':
if project_name == 'taichi':
upload_taichi_version()
os.system('{} -m twine upload {} ../dist/* --verbose -u {}'.format(
get_python_executable(), pypi_repo, pypi_user))
elif mode == 'test':
Expand Down

0 comments on commit a62dce5

Please sign in to comment.