Bump version to 0.3.1 #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish to PyPI | |
| on: | |
| push: | |
| branches: [ main ] | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Check if version changed | |
| id: version_check | |
| run: | | |
| VERSION=$(grep -E '^version = ' pyproject.toml | cut -d'"' -f2) | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| if git diff HEAD^ HEAD -- pyproject.toml | grep -q 'version ='; then | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Build package | |
| if: steps.version_check.outputs.changed == 'true' | |
| run: uv build | |
| - name: Publish to PyPI | |
| if: steps.version_check.outputs.changed == 'true' | |
| env: | |
| UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
| run: uv publish | |
| - name: Create GitHub Release | |
| if: steps.version_check.outputs.changed == 'true' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| VERSION=${{ steps.version_check.outputs.version }} | |
| gh release create "v$VERSION" \ | |
| --title "v$VERSION" \ | |
| --generate-notes \ | |
| dist/* |