Skip to content

Commit a62dce5

Browse files
authored
upload version (#119)
1 parent d1cdb0e commit a62dce5

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,12 @@ jobs:
9494
- name: Upload PyPI
9595
env:
9696
# https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets#using-encrypted-secrets-in-a-workflow
97-
PROD_PWD: ${{ secrets.PYPI_PWD_PROD }}
97+
PROD_PWD: 'asdfasdf'
9898
NIGHT_PWD: ${{ secrets.PYPI_PWD_NIGHTLY }}
9999
PROJECT_NAME: ${{ matrix.name }}
100100
PYTHON: ${{ matrix.python }}
101+
USERNAME: ${{ secrets.METADATA_USERNAME }}
102+
PASSWORD: ${{ secrets.METADATA_PASSWORD }}
101103
run: |
102104
mkdir dist
103105
cp wheel/*.whl dist/

python/build.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import argparse
22
import os
3+
import requests
34
import platform
45
import re
56
import shutil
@@ -81,6 +82,15 @@ def parse_args():
8182
help='Set the project name')
8283
return parser.parse_args()
8384

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

8595
def main():
8696
args = parse_args()
@@ -115,6 +125,8 @@ def main():
115125
if mode == 'build':
116126
return
117127
elif mode == 'upload':
128+
if project_name == 'taichi':
129+
upload_taichi_version()
118130
os.system('{} -m twine upload {} ../dist/* --verbose -u {}'.format(
119131
get_python_executable(), pypi_repo, pypi_user))
120132
elif mode == 'test':

0 commit comments

Comments
 (0)