chore(release): prepare v1.5.2 #11
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: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| 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: Verify tag matches version | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| python - <<'PY' | |
| import os | |
| import pathlib | |
| import re | |
| tag = os.environ["GITHUB_REF_NAME"] | |
| text = pathlib.Path("fakegpu/_version.py").read_text(encoding="utf-8") | |
| match = re.search(r'__version__\s*=\s*"([^"]+)"\s*$', text, re.M) | |
| if not match: | |
| raise SystemExit("Could not parse __version__ from fakegpu/_version.py") | |
| version = match.group(1) | |
| expected = f"v{version}" | |
| if tag != expected: | |
| raise SystemExit(f"Tag {tag!r} does not match expected {expected!r}") | |
| PY | |
| - name: Build sdist (Python source distribution) | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install build | |
| python -m build --sdist --outdir dist | |
| python - <<'PY' | |
| from pathlib import Path | |
| dist = Path("dist") | |
| sdists = sorted(dist.glob("fakegpu-*.tar.gz")) | |
| if not sdists: | |
| raise SystemExit("No sdist found in dist/") | |
| src = sdists[-1] | |
| base = src.name.removesuffix(".tar.gz") | |
| dst = dist / f"{base}-python-sdist.tar.gz" | |
| if dst.exists(): | |
| dst.unlink() | |
| src.rename(dst) | |
| print(f"sdist: {dst}") | |
| PY | |
| - name: Build wheel (manylinux x86_64) | |
| uses: pypa/cibuildwheel@v2.21.3 | |
| with: | |
| output-dir: dist | |
| env: | |
| CIBW_BUILD: "cp311-manylinux_x86_64" | |
| CIBW_BUILD_VERBOSITY: "1" | |
| - name: Create GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| dist/*.whl | |
| dist/*-python-sdist.tar.gz | |
| generate_release_notes: true |