Skip to content

Commit 305bd38

Browse files
committed
[main]: update workflow
1 parent 8e7de46 commit 305bd38

2 files changed

Lines changed: 18 additions & 17 deletions

File tree

.github/workflows/publish.yml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ on:
77

88
env:
99
REPO_ALIAS: rz-sample
10-
TEST_PYPI_URL: https://test.pypi.org
10+
TEST_PYPI_URL: https://test.pypi.org/legacy/
1111

1212
jobs:
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
@@ -56,9 +47,13 @@ jobs:
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
@@ -69,3 +64,9 @@ jobs:
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

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "rz-sample"
3-
version = "1.2.2"
3+
version = "1.2.3"
44
description = "A python template for fastapi and streamlit projects."
55
authors = [{ name = "sample", email = "recursivezero@outlook.com" }]
66
license = "MIT"

0 commit comments

Comments
 (0)