Skip to content

Commit 0b76313

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents 832cc2e + 3160b4b commit 0b76313

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

.github/workflows/pypi-publish.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,23 @@ jobs:
1616

1717
- uses: pdm-project/setup-pdm@v3
1818

19+
- name: Get current version from PyPI
20+
id: get_pypi_version
21+
run: |
22+
PACKAGE_NAME=$(pdm info | grep 'Name:' | awk '{print $2}')
23+
CURRENT_VERSION=$(pdm info | grep 'Version:' | awk '{print $2}')
24+
PYPI_VERSION=$(curl -s https://pypi.org/pypi/$PACKAGE_NAME/json | jq -r '.info.version')
25+
echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_ENV
26+
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
27+
echo "PYPI_VERSION=$PYPI_VERSION" >> $GITHUB_ENV
28+
29+
- name: Check if versions are different
30+
id: check_versions
31+
run: |
32+
if [ "$CURRENT_VERSION" != "$PYPI_VERSION" ]; then
33+
echo "versions_different=true" >> $GITHUB_ENV
34+
else
35+
echo "versions_different=false" >> $GITHUB_ENV
36+
1937
- name: Publish package distributions to PyPI
2038
run: pdm publish

0 commit comments

Comments
 (0)