Skip to content

Commit c1d8631

Browse files
committed
[chore] unified the release and pypi in CI
1 parent 3606702 commit c1d8631

1 file changed

Lines changed: 28 additions & 23 deletions

File tree

.github/workflows/docker.yml

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ on:
88

99
jobs:
1010
publish_package:
11-
name: Publish package
12-
11+
name: Build and Publish
1312
runs-on: ubuntu-latest
13+
1414
steps:
1515
- uses: actions/checkout@v3
1616

@@ -22,30 +22,35 @@ jobs:
2222
run: |
2323
pip install setuptools wheel twine
2424
25-
- name: Build core package
25+
- name: Extract version info
26+
id: version
27+
run: |
28+
VERSION=$(python setup.py --version)
29+
PACKAGE_NAME=$(python setup.py --name)
30+
echo "version=$VERSION" >> $GITHUB_OUTPUT
31+
echo "package_name=$PACKAGE_NAME" >> $GITHUB_OUTPUT
32+
33+
- name: Build package
2634
env:
2735
FLASH_ATTENTION_SKIP_CUDA_BUILD: "TRUE"
2836
run: |
29-
python setup.py sdist --dist-dir=dist
37+
python setup.py sdist bdist_wheel --dist-dir=dist
3038
3139
- name: Check if version exists on PyPI
32-
id: check-version
40+
id: check-pypi
3341
run: |
34-
VERSION=$(python setup.py --version)
35-
PACKAGE_NAME=$(python setup.py --name)
36-
echo "Detected version: $VERSION"
37-
echo "Detected package: $PACKAGE_NAME"
38-
EXISTS=$(curl --silent -f https://pypi.org/pypi/${PACKAGE_NAME}/${VERSION}/json > /dev/null && echo "yes" || echo "no")
42+
VERSION="${{ steps.version.outputs.version }}"
43+
PACKAGE="${{ steps.version.outputs.package_name }}"
44+
EXISTS=$(curl --silent -f https://pypi.org/pypi/${PACKAGE}/${VERSION}/json > /dev/null && echo "yes" || echo "no")
3945
echo "exists=$EXISTS" >> "$GITHUB_OUTPUT"
4046
41-
- name: Deploy to PyPI
42-
if: steps.check-version.outputs.exists == 'no'
47+
- name: Upload to PyPI
48+
if: steps.check-pypi.outputs.exists == 'no'
4349
env:
4450
TWINE_USERNAME: "__token__"
4551
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
4652
run: |
47-
python -m twine upload dist/*
48-
53+
twine upload dist/*
4954
5055
- name: Check if GitHub Release exists
5156
id: check-release
@@ -54,14 +59,7 @@ jobs:
5459
run: |
5560
TAG="v${{ steps.version.outputs.version }}"
5661
EXISTS=$(gh release view "$TAG" > /dev/null 2>&1 && echo "yes" || echo "no")
57-
echo "Release tag: $TAG"
58-
echo "Release exists: $EXISTS"
59-
echo "exists=$EXISTS" >> "$GITHUB_OUTPUT"
60-
61-
62-
- name: Debug Release Check
63-
run: |
64-
echo "Release exists: ${{ steps.check-release.outputs.exists }}"
62+
echo "exists=$EXISTS" >> $GITHUB_OUTPUT
6563
6664
- name: Create GitHub Release
6765
if: steps.check-release.outputs.exists == 'no'
@@ -70,4 +68,11 @@ jobs:
7068
run: |
7169
gh release create v${{ steps.version.outputs.version }} dist/* \
7270
--title "Release v${{ steps.version.outputs.version }}" \
73-
--notes "Automated release from GitHub Actions"
71+
--notes "Automated release from GitHub Actions"
72+
73+
- name: Debug Info (optional)
74+
run: |
75+
echo "Package: ${{ steps.version.outputs.package_name }}"
76+
echo "Version: ${{ steps.version.outputs.version }}"
77+
echo "PyPI Exists: ${{ steps.check-pypi.outputs.exists }}"
78+
echo "GitHub Release Exists: ${{ steps.check-release.outputs.exists }}"

0 commit comments

Comments
 (0)