Bump version to 0.1.5 #2
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 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - pyproject.toml | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/tinybird-sdk | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Detect version change | |
| id: version_check | |
| run: | | |
| BEFORE_SHA="${{ github.event.before }}" | |
| AFTER_SHA="${{ github.sha }}" | |
| BEFORE_VERSION="$(git show "${BEFORE_SHA}:pyproject.toml" 2>/dev/null | sed -nE 's/^version = "([^"]+)"/\1/p' | head -n1)" | |
| AFTER_VERSION="$(sed -nE 's/^version = "([^"]+)"/\1/p' pyproject.toml | head -n1)" | |
| echo "before_version=${BEFORE_VERSION}" >> "$GITHUB_OUTPUT" | |
| echo "after_version=${AFTER_VERSION}" >> "$GITHUB_OUTPUT" | |
| if [ -z "$AFTER_VERSION" ]; then | |
| echo "Could not read current version from pyproject.toml" | |
| exit 1 | |
| fi | |
| if [ "$BEFORE_VERSION" = "$AFTER_VERSION" ]; then | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| echo "No version bump detected (${AFTER_VERSION}); skipping publish." | |
| else | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| echo "Version changed: ${BEFORE_VERSION} -> ${AFTER_VERSION}" | |
| fi | |
| - name: Set up Python | |
| if: steps.version_check.outputs.changed == 'true' | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install build dependencies | |
| if: steps.version_check.outputs.changed == 'true' | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install build | |
| - name: Build distributions | |
| if: steps.version_check.outputs.changed == 'true' | |
| run: python -m build | |
| - name: Publish package to PyPI | |
| if: steps.version_check.outputs.changed == 'true' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| password: ${{ secrets.PYPI_TOKEN }} |