@@ -18,35 +18,49 @@ jobs:
1818 uses : actions/checkout@v4.1.7
1919 with :
2020 token : ${{ secrets.RELEASE_GIT_TOKEN }}
21- - name : " Install Poetry "
22- run : " pipx install poetry "
21+ - name : " Install uv "
22+ run : " pipx install uv "
2323 - name : " Set up Python 3.12"
2424 uses : " actions/setup-python@v5"
2525 with :
2626 python-version : " 3.12"
27- cache : " poetry "
27+ cache : " uv "
2828 - name : Update version in pyproject.toml
29+ id : version_bump
2930 run : |
30- poetry version patch
31+ OLD_VERSION=$(awk -F ' = ' '/^version =/ {gsub(/"/, "", $2); print $2}' pyproject.toml)
32+
33+ IFS='.' read -r -a V_PARTS <<< "$OLD_VERSION"
34+ V_PARTS[2]=$((V_PARTS[2] + 1))
35+ NEW_VERSION="${V_PARTS[0]}.${V_PARTS[1]}.${V_PARTS[2]}"
36+
37+ # Using awk for safer replacement
38+ awk -v old="version = \"$OLD_VERSION\"" -v new="version = \"$NEW_VERSION\"" '{gsub(old, new)}1' pyproject.toml > pyproject.toml.tmp && mv pyproject.toml.tmp pyproject.toml
39+
40+ echo "New version: $NEW_VERSION"
41+ echo "VERSION=$NEW_VERSION" >> "$GITHUB_OUTPUT"
3142 - name : Commit and push changes
3243 run : |
3344 git config --global user.email "github@actions.com"
34- git config --global user.name "GitHub Actions "
35- git add .
45+ git config --global user.name "GitHub Actions"
46+ git add pyproject.toml
3647 if [[ -n "$(git diff --cached)" ]]; then
37- git commit -m "Dump version to $(poetry version -s) [skip ci]"
48+ git commit -m "Bump version to ${{ steps.version_bump.outputs.VERSION }} [skip ci]"
3849 git push
3950 else
4051 echo "No changes to commit"
4152 fi
4253 - name : Extract version from pyproject.toml
4354 id : extract_metadata
4455 run : |
45- VERSION=$(awk -F ' = ' '/version =/ {gsub(/"/, "", $2); print $2}' ./pyproject.toml)
46- LABELS="version=$VERSION,latest"
47- echo "::set-output name=version::$VERSION"
48- echo "::set-output name=labels::$LABELS"
49- shell : /usr/bin/bash -e {0}
56+ VERSION=$(awk -F ' = ' '/^version =/ {gsub(/"/, "", $2); print $2}' ./pyproject.toml)
57+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
58+ shell : bash
59+ - name : Build and Upload Package
60+ run : |
61+ pipx inject uv twine
62+ uv dist-build
63+ uv twine-upload --user __token__ --password ${{ secrets.PYPI_API_TOKEN }} dist/*
5064 - name : Release New Version
5165 uses : softprops/action-gh-release@v1
5266 with :
0 commit comments