fix(exports): trigger release with correct ORM __init__ exports #71
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: 🧹 Lint, Test, Tag, and Publish | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| permissions: | |
| contents: write | |
| id-token: write | |
| env: | |
| TEST_PYPI_URL: https://test.pypi.org/legacy/ | |
| PROD_PYPI_URL: https://upload.pypi.org/legacy/ | |
| jobs: | |
| lint: | |
| name: 🧹 Lint & Security | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 🧾 Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: 🐍 Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: 📦 Cache pip dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-lint-pip-${{ hashFiles('**/pyproject.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-lint-pip- | |
| - name: 🔧 Install lint dependencies | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| pip install --index-url https://pypi.org/simple/ -e ".[dev]" | |
| - name: ⚫ Run Black (Format Check) | |
| run: black --check . | |
| - name: ⚫ Run isort (Import Sort Check) | |
| run: isort --check . | |
| - name: 🔒 Run Bandit (Security Scan) | |
| run: bandit -r src/ -c .bandit.yml || true | |
| - name: 🔍 Run Mypy (Type Check) | |
| run: mypy src/ --ignore-missing-imports || true | |
| test: | |
| name: ✅ Test on Python ${{ matrix.python-version }} | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - name: 🧾 Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: 🐍 Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: 📦 Cache pip dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip-${{ matrix.python-version }}- | |
| ${{ runner.os }}-pip- | |
| - name: 🔧 Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| pip install --index-url https://pypi.org/simple/ -e ".[dev]" | |
| - name: ✅ Run unit tests | |
| run: pytest tests/ --ignore=tests/e2e -v | |
| release: | |
| name: 🚀 Tag, Build, and Publish | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: "github.ref_type == 'branch' && (github.ref_name == 'main' || github.ref_name == 'master')" | |
| steps: | |
| - name: 🧾 Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: 🐍 Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: 🔧 Install build and dev tools | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel build | |
| pip install --index-url https://pypi.org/simple/ -e ".[dev]" | |
| - name: 🚀 Setup Node.js for semantic-release | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: 🔧 Install semantic-release and plugins | |
| run: | | |
| npm install -g semantic-release \ | |
| @semantic-release/git \ | |
| @semantic-release/changelog \ | |
| @semantic-release/github \ | |
| @semantic-release/exec \ | |
| conventional-changelog-conventionalcommits | |
| - name: 🔢 Run semantic-release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: npx semantic-release | |
| - name: 🏗️ Build Python package | |
| run: python -m build | |
| - name: 🛡️ Verify build artifacts | |
| run: | | |
| ls -lh dist | |
| test -n "$(ls -A dist 2>/dev/null)" || (echo "❌ dist/ is empty — build failed." && exit 1) | |
| - name: 🧠 Decide publish target | |
| id: repo | |
| run: | | |
| echo "repo_url=${{ env.PROD_PYPI_URL }}" >> $GITHUB_OUTPUT | |
| echo "is_prod=true" >> $GITHUB_OUTPUT | |
| - name: 📦 Publish to Production PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| if: steps.repo.outputs.is_prod == 'true' | |
| with: | |
| user: "__token__" | |
| password: ${{ secrets.PYPI_API_TOKEN }} | |
| repository_url: ${{ steps.repo.outputs.repo_url }} | |
| skip-existing: true |