Skip to content

Commit 1d0f823

Browse files
committed
ci: adjust shinny-pip support package building position
reuse previous build step to avoid repeating build code.
1 parent 1dd0f7b commit 1d0f823

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

.github/workflows/run-tqsdk.yml

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,21 @@ jobs:
344344
sudo apt install pandoc
345345
python -m pip install -r requirements.txt
346346
347+
- name: edit setup.py to support shinny-pip
348+
if: github.event.client_payload.pr_flag == 'true'
349+
shell: bash
350+
env:
351+
PAYLOAD_SHA: ${{ github.event.client_payload.sha }}
352+
PAYLOAD_REF: ${{ github.event.client_payload.ref }}
353+
run: |
354+
version_pattern="version\s*=\s*['\"].*['\"]"
355+
short_sha=${PAYLOAD_SHA:0:7}
356+
ref_name=${PAYLOAD_REF##*/}
357+
new_version="0.0.0+${ref_name}.$short_sha"
358+
sed -i "s|$version_pattern|version = \"$new_version\"|" setup.py
359+
dest_dir=${ref_name}/$short_sha/
360+
echo "DEST_DIR=$dest_dir" >> $GITHUB_ENV
361+
347362
- name: Build bdist wheel
348363
shell: bash
349364
run: |
@@ -411,25 +426,8 @@ jobs:
411426
- name: Upload to Oss - pr
412427
if: github.event.client_payload.pr_flag == 'true'
413428
shell: bash
414-
env:
415-
PAYLOAD_SHA: ${{ github.event.client_payload.sha }}
416-
PAYLOAD_REF: ${{ github.event.client_payload.ref }}
417429
run: |
418-
cp setup.py setup.py.bak
419-
420-
version_pattern="version\s*=\s*['\"].*['\"]"
421-
short_sha=${PAYLOAD_SHA:0:7}
422-
ref_name=${PAYLOAD_REF##*/}
423-
new_version="0.0.0+${ref_name}.$short_sha"
424-
sed -i "s|$version_pattern|version = \"$new_version\"|" setup.py
425-
426-
python setup.py bdist_wheel -p any
427-
428-
dest_dir=${ref_name}/$short_sha/
429-
wheel_file=$(ls dist/tqsdk-0.0.0*.whl)
430-
ossutil cp -f "$wheel_file" oss://shinny-cd/tqsdk/"$dest_dir"dist/
431-
432-
mv setup.py.bak setup.py
430+
ossutil cp -f dist/*.whl oss://shinny-cd/tqsdk/"$DEST_DIR"dist/
433431
434432
tqsdk-python:
435433
name: tqsdk-python commit and pr

0 commit comments

Comments
 (0)