diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4a52339 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,57 @@ +name: release + +# Publishes to PyPI on a version tag. The full suite runs first; a tag on a red +# commit never publishes. Uses PyPI Trusted Publishing (OIDC) — there is NO PyPI +# token stored in the repo or in GitHub Secrets (an ephemeral OIDC identity is +# minted per run and never exists outside the runner). + +on: + push: + tags: ["v*"] + +permissions: + contents: read + +jobs: + verify: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install + run: | + python -m pip install --upgrade pip + pip install -e ".[dev]" + pip install pip-audit + - name: Lint (ruff) + run: ruff check rm_validate tests + - name: Type check (mypy) + run: mypy rm_validate + - name: Tests (pytest) + run: pytest -q + - name: Dependency audit + run: pip-audit + - name: Self-check + run: python -m rm_validate check . + + publish: + needs: verify + runs-on: ubuntu-latest + # Declared so a manual-approval protection rule can gate publishing if desired. + environment: pypi + permissions: + id-token: write # Trusted Publishing — no username/password/token + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Build sdist + wheel + run: | + python -m pip install --upgrade pip build twine + python -m build + twine check dist/* + - name: Publish to PyPI (Trusted Publishing) + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/CHANGELOG.md b/CHANGELOG.md index edb8038..25155b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ All notable changes to this project are documented here. The format follows ## [0.1.1] — Cierre del bypass de inferencia (fix de seguridad del harness) +### Added +- Distribución: workflow de release a PyPI vía Trusted Publishing (OIDC, sin + token almacenado); un tag `v*` dispara verify (lint+types+tests+audit+self-check) + y recién después publica. README con sección de instalación (`pipx install + rm-validate`) y badges (PyPI, CI, licencia). + ### Security - `inference.exclude` deja de existir como clave pública: permitía silenciar el candado de capability-mismatch desde el mismo `rm-policy.yaml` que el candado @@ -30,6 +36,9 @@ All notable changes to this project are documented here. The format follows y aplicada solo a rm-tooling (paquete `rm_validate/` presente + `project: rm-tooling`), no con configuración expuesta al consumidor. - CI propio: `pip-audit` corre sin `|| true`. +- `pyproject.toml`: las URLs del proyecto apuntaban a un repo inexistente + (`github.com/rm-tooling/rm-validate`) → corregidas a `edarm92-arch/rm-tooling` + (+ Issues y Changelog). ## [0.1.0] — rm-policy-validator inicial (público, Apache-2.0) diff --git a/README.md b/README.md index e104036..5801c94 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # rm-validate +[![PyPI](https://img.shields.io/pypi/v/rm-validate.svg)](https://pypi.org/project/rm-validate/) +[![CI](https://github.com/edarm92-arch/rm-tooling/actions/workflows/ci.yml/badge.svg)](https://github.com/edarm92-arch/rm-tooling/actions/workflows/ci.yml) +[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE) + **A generic policy validator for the RM Method.** It reads a repo's own `rm-policy.yaml`, runs the checks that its declared capabilities gate plus a non-negotiable universal base, and reports `file · rule · value vs. limit · @@ -20,14 +24,14 @@ in the policy — the validator never guesses, and never silently skips. ## Install ```bash -# from PyPI (once published) -pip install rm-validate +# recommended — isolated global CLI +pipx install rm-validate -# or straight from Git -pip install "git+https://github.com/rm-tooling/rm-validate" +# or plain pip +pip install rm-validate -# or run without installing -uvx --from "git+https://github.com/rm-tooling/rm-validate" rm-validate check . +# or from source (before the first PyPI release, or to track main) +pipx install "git+https://github.com/edarm92-arch/rm-tooling" ``` Only runtime dependency: **PyYAML**. Python 3.11+. diff --git a/pyproject.toml b/pyproject.toml index 1458508..c06be6f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,14 +20,16 @@ classifiers = [ dependencies = ["PyYAML>=6.0"] [project.urls] -Homepage = "https://github.com/rm-tooling/rm-validate" -Source = "https://github.com/rm-tooling/rm-validate" +Homepage = "https://github.com/edarm92-arch/rm-tooling" +Source = "https://github.com/edarm92-arch/rm-tooling" +Issues = "https://github.com/edarm92-arch/rm-tooling/issues" +Changelog = "https://github.com/edarm92-arch/rm-tooling/blob/main/CHANGELOG.md" [project.scripts] rm-validate = "rm_validate.__main__:main" [project.optional-dependencies] -dev = ["ruff>=0.5", "mypy>=1.10", "pytest>=8.0", "types-PyYAML>=6.0"] +dev = ["ruff>=0.5", "mypy>=1.10", "pytest>=8.0", "types-PyYAML>=6.0", "build>=1.2", "twine>=5.0"] [tool.setuptools.packages.find] include = ["rm_validate*"]