Skip to content

Commit 0b6aff2

Browse files
committed
fix: PyPi'ǵa deploy qılıw waqıtında aldınǵı versiya faylları óshriledi
1 parent 28fe513 commit 0b6aff2

1 file changed

Lines changed: 33 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,43 @@ jobs:
2121
- name: Install dependencies
2222
run: |
2323
python -m pip install --upgrade pip
24-
pip install build twine
24+
pip install build twine toml
25+
26+
# Extract version from tag (remove the "v" prefix)
27+
- name: Extract version from tag
28+
id: get_version
29+
run: |
30+
VERSION="${GITHUB_REF_NAME#v}"
31+
echo "VERSION=$VERSION" >> $GITHUB_ENV
32+
echo "Detected version: $VERSION"
33+
34+
# Update version in pyproject.toml (if exists)
35+
- name: Update version in pyproject.toml
36+
if: ${{ hashFiles('pyproject.toml') != '' }}
37+
run: |
38+
python -c "
39+
import toml
40+
f='pyproject.toml'
41+
data=toml.load(f)
42+
if 'project' in data:
43+
data['project']['version'] = '${{ env.VERSION }}'
44+
else:
45+
data['tool']['poetry']['version'] = '${{ env.VERSION }}'
46+
toml.dump(data, open(f, 'w'))
47+
"
48+
49+
# Update version in setup.py (fallback)
50+
- name: Update version in setup.py
51+
if: ${{ hashFiles('setup.py') != '' }}
52+
run: |
53+
sed -i "s/version=.*,/version='${{ env.VERSION }}',/" setup.py
2554

2655
- name: Build package
2756
run: python -m build
2857

29-
- name: Publish to PyPi
58+
- name: Publish to PyPI
3059
env:
60+
TWINE_USERNAME: __token__
3161
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
3262
run: |
33-
python -m twine upload --username __token__ --password "$TWINE_PASSWORD" dist/*
63+
python -m twine upload --non-interactive dist/*

0 commit comments

Comments
 (0)