chore: release v0.23.2 (#371) #38
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: publish | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-and-publish: | |
| if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v') | |
| runs-on: ubuntu-latest | |
| environment: pypi | |
| permissions: | |
| contents: read | |
| id-token: write # required for PyPI Trusted Publishing (OIDC) | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Verify tag matches every declared version | |
| run: | | |
| set -e | |
| python - "${GITHUB_REF_NAME#v}" <<'EOF' | |
| import json, pathlib, re, sys, tomllib | |
| expected = sys.argv[1] | |
| versions = { | |
| "pyproject.toml": tomllib.loads(pathlib.Path("pyproject.toml").read_text())["project"]["version"], | |
| "src/brigade/__init__.py": re.search( | |
| r'__version__ = "([^"]+)"', pathlib.Path("src/brigade/__init__.py").read_text() | |
| ).group(1), | |
| } | |
| for path in sorted(pathlib.Path("src/brigade/templates").rglob("*.json")): | |
| fields = json.loads(path.read_text()) | |
| if "_brigade_version" in fields: | |
| versions[str(path)] = fields["_brigade_version"] | |
| mismatched = {p: v for p, v in versions.items() if v != expected} | |
| print(f"tag={expected} checked={len(versions)} locations") | |
| for p, v in mismatched.items(): | |
| print(f"::error::{p} declares {v}, tag says {expected}") | |
| sys.exit(1 if mismatched else 0) | |
| EOF | |
| - name: Install build tooling | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install build | |
| - name: Build sdist + wheel | |
| run: python -m build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b |