✨ Add --python option to xaibo init command
#111
Workflow file for this run
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: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| release: | |
| types: [ created ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| version: latest | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: latest | |
| - name: Install dependencies | |
| run: | | |
| # Install all dependency groups needed for tests | |
| uv sync --all-extras --all-groups | |
| - name: Run tests | |
| run: | | |
| uv run pytest | |
| build-and-publish: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name == 'release' && github.event.action == 'created' }} | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/<your-pypi-project-name> | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| version: latest | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: latest | |
| - name: Extract version from tag | |
| id: get_version | |
| run: | | |
| # Extract tag name from github.ref (e.g., 'refs/tags/v1.2.3' -> 'v1.2.3') | |
| TAG=${GITHUB_REF#refs/tags/} | |
| # Remove 'v' prefix if present (e.g., 'v1.2.3' -> '1.2.3') | |
| VERSION=${TAG#v} | |
| # Set output for use in later steps | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "Extracted version: $VERSION" | |
| - name: Update version in pyproject.toml | |
| run: | | |
| # Use sed to replace the version line in pyproject.toml | |
| sed -i "s/^version = \".*\"/version = \"$VERSION\"/" pyproject.toml | |
| echo "Updated pyproject.toml with version $VERSION" | |
| cat pyproject.toml | grep version | |
| - name: Build package | |
| run: | | |
| uv build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: dist/ |