bump version to v0.2.0 #2
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: release | |
| on: | |
| push: | |
| tags: ["v*"] | |
| workflow_dispatch: | |
| inputs: | |
| publish: | |
| description: "Publish to PyPI" | |
| required: true | |
| default: "false" | |
| type: choice | |
| options: ["false", "true"] | |
| jobs: | |
| quality: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install -e ".[dev]" | |
| - name: Run tests | |
| run: python -m pytest -q | |
| - name: Run security checks | |
| run: python -m bandit -q -r src/predicate_secure/ | |
| - name: Run pre-commit checks | |
| run: | | |
| python -m pip install pre-commit | |
| pre-commit run --all-files | |
| publish: | |
| runs-on: ubuntu-latest | |
| needs: [quality] | |
| if: (github.event_name == 'workflow_dispatch' && inputs.publish == 'true') || startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install build tooling | |
| run: python -m pip install --upgrade pip build twine | |
| - name: Validate version matches tag | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| TAG_VERSION="${GITHUB_REF_NAME#v}" | |
| PKG_VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])") | |
| if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then | |
| echo "Tag version ($TAG_VERSION) does not match package version ($PKG_VERSION)" | |
| exit 1 | |
| fi | |
| echo "Version validated: $PKG_VERSION" | |
| - name: Build package | |
| run: python -m build | |
| - name: Validate distribution metadata | |
| run: twine check dist/* | |
| - name: Publish to PyPI | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN_PREDICATE_SECURE }} | |
| run: twine upload dist/* |