Finalize CLI, package, and repo polish for test release #1
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*" | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Upgrade pip | |
| run: python -m pip install --upgrade pip | |
| - name: Install release dependencies | |
| run: python -m pip install -e .[release] | |
| - name: Build package | |
| run: python -m build | |
| - name: Check package metadata | |
| run: python -m twine check dist/* | |
| - name: Validate version and release note | |
| shell: bash | |
| run: | | |
| python - <<'PY' | |
| import pathlib | |
| import tomllib | |
| import sys | |
| root = pathlib.Path(".") | |
| sys.path.insert(0, str(root / "src")) | |
| from code2skill import __version__ | |
| tag = "${{ github.ref_name }}" | |
| version = tag.removeprefix("v") | |
| pyproject = tomllib.loads((root / "pyproject.toml").read_text(encoding="utf-8")) | |
| declared = pyproject["project"]["version"] | |
| if declared != version: | |
| raise SystemExit(f"Tag {tag} does not match pyproject version {declared}.") | |
| if __version__ != version: | |
| raise SystemExit(f"Tag {tag} does not match runtime version {__version__}.") | |
| release_note = root / "docs" / "releases" / f"v{version}.md" | |
| if not release_note.exists(): | |
| raise SystemExit(f"Missing release note file: {release_note}") | |
| PY | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| body_path: docs/releases/${{ github.ref_name }}.md |