aboutsummaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/publish.yml60
1 files changed, 60 insertions, 0 deletions
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
new file mode 100644
index 0000000..4fc675c
--- /dev/null
+++ b/.github/workflows/publish.yml
@@ -0,0 +1,60 @@
+name: Publish
+
+# Publica en PyPI cuando se publica un release de GitHub.
+#
+# No hay ningún token guardado: PyPI confía en este workflow por OIDC
+# (trusted publishing). Del lado de pypi.org hay que haber dado de alta un
+# "pending publisher" con exactamente estos cuatro datos:
+#
+# Owner ElvisClaros
+# Repository claude-logbook
+# Workflow publish.yml
+# Environment pypi
+#
+# Si alguno no coincide, PyPI rechaza el upload.
+
+on:
+ release:
+ types: [published]
+
+permissions: {}
+
+jobs:
+ publish:
+ runs-on: ubuntu-latest
+
+ environment:
+ name: pypi
+ url: https://pypi.org/p/claude-logbook
+
+ permissions:
+ id-token: write # lo único que habilita el trusted publishing
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: actions/setup-python@v5
+ with:
+ python-version: "3.13"
+
+ # El número vive en claude_logbook/__init__.py y es fácil olvidarse de
+ # subirlo. Mejor fallar acá que publicar algo mal rotulado: una versión
+ # subida a PyPI no se puede reemplazar nunca, solo yankear.
+ - name: El tag coincide con __version__
+ run: |
+ tag="${GITHUB_REF_NAME#v}"
+ ver="$(python -c 'import claude_logbook; print(claude_logbook.__version__)')"
+ echo "tag=$tag __version__=$ver"
+ test "$tag" = "$ver"
+
+ - name: Build
+ run: |
+ python -m pip install --upgrade build
+ python -m build
+
+ - name: Los artefactos están sanos
+ run: |
+ python -m pip install --upgrade twine
+ twine check dist/*
+
+ - uses: pypa/gh-action-pypi-publish@release/v1