Skip to content

Commit d948993

Browse files
Update publish.yml
Add a step to your workflow that will directly modify the version in all possible places right before building
1 parent b2e6c1d commit d948993

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

.github/workflows/publish.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v4
10+
with:
11+
fetch-depth: 0
1012

1113
- name: Set up Python
1214
uses: actions/setup-python@v4
1315
with:
1416
python-version: '3.12'
15-
cache: 'pip'
16-
cache-dependency-path: '.github/workflows/publish.yml'
1717

1818
- name: Install dependencies
1919
run: |
@@ -24,20 +24,23 @@ jobs:
2424
run: |
2525
rm -rf dist/ build/ *.egg-info/
2626
27-
- name: Verify version before build
27+
- name: Force set version to 0.1.3
2828
run: |
29-
echo "==== pyproject.toml version ===="
29+
# Update version in pyproject.toml
30+
sed -i 's/version = "0.1.2"/version = "0.1.3"/g' pyproject.toml
31+
# Also update any __version__ in Python files
32+
find . -name "*.py" -type f -exec sed -i 's/__version__ = "0.1.2"/__version__ = "0.1.3"/g' {} \;
33+
# Show the changes
34+
echo "Updated pyproject.toml version:"
3035
grep "version" pyproject.toml
3136
3237
- name: Build package
3338
run: python -m build
3439

35-
- name: Debug package version
40+
- name: Debug package files
3641
run: |
37-
echo "==== Built distribution files ===="
42+
echo "Built distribution files:"
3843
ls -la dist/
39-
echo "==== Checking tarball contents ===="
40-
tar -tzf dist/*.tar.gz | grep -E 'version|VERSION'
4144
4245
- name: Publish to PyPI
4346
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)