bump version to 0.5.1 #22
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 Version Change | |
| on: | |
| push: | |
| branches: ["main"] | |
| paths: | |
| - "pyproject.toml" | |
| workflow_dispatch: | |
| jobs: | |
| publish-and-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # Required for creating tags and releases | |
| id-token: write # Required for trusted publishing to PyPI | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| version: latest | |
| - id: version | |
| name: Read version from pyproject.toml | |
| run: | | |
| python - <<'PY' | |
| import os | |
| import tomllib | |
| from pathlib import Path | |
| data = tomllib.loads(Path("pyproject.toml").read_text()) | |
| version = data["project"]["version"] | |
| print(f"version: {version}") | |
| with open(os.environ["GITHUB_OUTPUT"], "a") as fh: | |
| fh.write(f"version={version}\n") | |
| PY | |
| - id: release_check | |
| name: Skip if release already exists | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| TAG="v${{ steps.version.outputs.version }}" | |
| if gh release view "$TAG" >/dev/null 2>&1; then | |
| echo "Release $TAG already exists — skipping." | |
| echo "skip=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "skip=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Set up Node.js | |
| if: steps.release_check.outputs.skip != 'true' | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Build frontend assets | |
| if: steps.release_check.outputs.skip != 'true' | |
| working-directory: frontend | |
| run: | | |
| npm ci | |
| npm run build | |
| - name: Build package | |
| if: steps.release_check.outputs.skip != 'true' | |
| run: uv build | |
| # Publishes using PyPI trusted publishing (OIDC — no API token needed). | |
| # Set this up at: https://pypi.org/manage/project/pixie-qa/settings/publishing/ | |
| - name: Publish to PyPI | |
| if: steps.release_check.outputs.skip != 'true' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| - name: Create GitHub release | |
| if: steps.release_check.outputs.skip != 'true' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| TAG="v${{ steps.version.outputs.version }}" | |
| gh release create "$TAG" \ | |
| dist/*.whl dist/*.tar.gz \ | |
| --title "$TAG" \ | |
| --notes "Release $TAG" |