77
88env :
99 REPO_ALIAS : rz-sample
10- TEST_PYPI_URL : https://test.pypi.org
10+ TEST_PYPI_URL : https://test.pypi.org/legacy/
1111
1212jobs :
13- # JOB 1: Quality Check
1413 lint :
1514 runs-on : ubuntu-latest
1615 steps :
@@ -19,21 +18,13 @@ jobs:
1918 uses : actions/setup-python@v5
2019 with :
2120 python-version : " 3.11"
21+ - name : Install Ruff
22+ run : pip install ruff
23+ - name : Run Ruff
24+ run : ruff check . && ruff format --check .
2225
23- - name : Install Linting Tools
24- run : |
25- python -m pip install --upgrade pip
26- pip install ruff
27-
28- - name : Run Ruff Check
29- run : ruff check .
30-
31- - name : Run Ruff Format Check
32- run : ruff format --check .
33-
34- # JOB 2: Build and Publish (Depends on Lint passing)
3526 build-and-publish :
36- needs : lint # This ensures publishing ONLY happens if linting passes
27+ needs : lint
3728 runs-on : ubuntu-latest
3829 steps :
3930 - name : Checkout code
5647 PACKAGE_VERSION=$(poetry version --short)
5748 STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://test.pypi.org)
5849
50+ echo "pkg_name=$PACKAGE_NAME" >> $GITHUB_OUTPUT
51+ echo "pkg_ver=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
52+
5953 if [ "$STATUS" == "200" ]; then
60- echo "Version $PACKAGE_VERSION already exists. Skipping."
6154 echo "should_publish=false" >> $GITHUB_OUTPUT
55+ echo "### ⏭️ Skip: Version $PACKAGE_VERSION already exists" >> $GITHUB_STEP_SUMMARY
56+ echo "No new version detected in pyproject.toml. Check it here: [TestPyPI](https://test.pypi.org)" >> $GITHUB_STEP_SUMMARY
6257 else
6358 echo "should_publish=true" >> $GITHUB_OUTPUT
6459 fi
6964 poetry config repositories.${{ env.REPO_ALIAS }} ${{ env.TEST_PYPI_URL }}
7065 poetry config pypi-token.${{ env.REPO_ALIAS }} ${{ secrets.TEST_PYPI_TOKEN }}
7166 poetry publish -r ${{ env.REPO_ALIAS }} --build
67+
68+ # Add Success Summary
69+ NAME=${{ steps.check_version.outputs.pkg_name }}
70+ VER=${{ steps.check_version.outputs.pkg_ver }}
71+ echo "### ✅ Success: Published $NAME v$VER" >> $GITHUB_STEP_SUMMARY
72+ echo "View your package on TestPyPI: [https://test.pypi.org](https://test.pypi.org)" >> $GITHUB_STEP_SUMMARY
0 commit comments