style: fix Black formatting in utils __init__.py #112
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: Semantic Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: # Allow manual triggering | |
| permissions: | |
| contents: write # Required for creating releases and pushing tags | |
| issues: write # Required for commenting on issues | |
| pull-requests: write # Required for commenting on PRs | |
| id-token: write # Required for trusted publishing to PyPI | |
| jobs: | |
| semantic-release: | |
| runs-on: ubuntu-latest | |
| if: github.repository_owner == 'bobmatnyc' # Only run on main repo | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Full history needed for semantic versioning | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install semantic release | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install python-semantic-release[mypy] | |
| - name: Configure Git | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Run semantic release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| semantic-release version | |
| - name: Check if new version was created | |
| id: check-version | |
| run: | | |
| if git describe --exact-match --tags HEAD >/dev/null 2>&1; then | |
| echo "new-version=true" >> $GITHUB_OUTPUT | |
| echo "version-tag=$(git describe --exact-match --tags HEAD)" >> $GITHUB_OUTPUT | |
| else | |
| echo "new-version=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Install build dependencies | |
| if: steps.check-version.outputs.new-version == 'true' | |
| run: | | |
| pip install -e ".[dev]" | |
| pip install build twine | |
| - name: Run tests for new version | |
| if: steps.check-version.outputs.new-version == 'true' | |
| run: | | |
| python -m pytest tests/ -v --tb=short | |
| ruff check src/ | |
| black --check src/ | |
| # mypy src/ # Temporarily disabled - needs comprehensive type annotations | |
| - name: Build package | |
| if: steps.check-version.outputs.new-version == 'true' | |
| run: | | |
| python -m build | |
| python -m twine check dist/* | |
| - name: Publish to PyPI | |
| if: steps.check-version.outputs.new-version == 'true' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| print-hash: true | |
| - name: Update GitHub release with assets | |
| if: steps.check-version.outputs.new-version == 'true' | |
| run: | | |
| gh release upload ${{ steps.check-version.outputs.version-tag }} dist/*.whl dist/*.tar.gz | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload build artifacts | |
| if: steps.check-version.outputs.new-version == 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: semantic-release-artifacts | |
| path: | | |
| dist/ | |
| CHANGELOG.md |