-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (107 loc) · 5.24 KB
/
Copy pathrelease.yml
File metadata and controls
113 lines (107 loc) · 5.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# El tag ES la publicación. `git push origin vX.Y.Z` y esto publica UN wheel en PyPI: `pinecall`,
# que lleva adentro las once distribuciones internas de packages/ (packages/pinecall/hatch_build.py).
# Ninguna de ellas se publica sola; son la organización del código, no paquetes.
#
# Este repo depende del de al lado: hasta que `pinecall-protocol` esté publicado con un rango,
# tests/test_the_version.py no deja pasar un tag. El orden es protocol primero, siempre.
name: release
on:
push:
tags: ["v*"]
# Para ensayar el camino sin quemar un número: corre guard + gates, y publish queda skipped
# porque no es un tag.
workflow_dispatch:
permissions:
contents: read
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
# Una versión de PyPI es permanente: un artefacto cuyo nombre miente no se deshace. Dos
# preguntas antes de tocar el registro — si el tag y el árbol dicen el mismo número, y si las
# dependencias que el wheel va a declarar son publicables.
guard:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.declared.outputs.version }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
# En dos líneas y no en una: `echo "version=$(scripts/the-version)"` se come el exit code
# del script — echo sale 0 — y el paso queda VERDE con la versión vacía, que es exactamente
# lo que un guard no puede hacer. Una asignación sí propaga el estado bajo `bash -e`.
- id: declared
run: |
version=$(scripts/the-version)
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: el tag y la versión declarada son el mismo número
if: github.ref_type == 'tag'
run: |
tag="${GITHUB_REF_NAME#v}"
declared="${{ steps.declared.outputs.version }}"
if [ "$tag" != "$declared" ]; then
echo "el tag dice $tag y el árbol declara $declared — uno de los dos está mal" >&2
exit 1
fi
echo "v$declared"
# El gate de verdad, el mismo que corre en cada push: lint y los dos rings contra Postgres. Un
# push de tag NO matchea `push: branches` de ci.yml — un tag no es una rama — así que sin esta
# línea el camino del release no tendría gate ninguno.
gates:
uses: ./.github/workflows/ci.yml
# Trusted Publishing NO funciona dentro de un workflow reusable: lo reusable son los tests, el
# publish se queda acá arriba.
publish-pypi:
needs: [guard, gates]
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write # OIDC, sin token guardado en ningún lado
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
path: runtime
# El repo de al lado, por si `[tool.uv.sources]` todavía nombra la ruta: hatchling no
# resuelve dependencias para armar el wheel, pero uv sí lee esa tabla.
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
repository: pinecall/protocol
path: protocol
# The two browser pages, from the two repositories scripts/console reads them from — its
# defaults are ../console and ../widget, which is this layout. The step used to check out
# pinecall/agents, where the console once lived, and died at "no console checkout".
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
repository: pinecall/console
path: console
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
repository: pinecall/widget
path: widget
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
with:
version: 11.2.2
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
# The console and the admin are gitignored build output, and `uv build` packs whatever is in
# the tree — so a wheel built straight after a checkout carries NO pages, and a
# `pip install pinecall` gateway answers every screen with "run scripts/console", which the
# person who installed a package cannot do. They are built here, from the agents checkout,
# before anything is packed.
- run: pnpm install --frozen-lockfile
working-directory: console
- run: scripts/console
working-directory: runtime
- run: test -f runtime/packages/pinecall/src/pinecall/public/console/index.html
# Un wheel y ningún sdist: el sdist de un bundle necesitaría las once adentro, en un layout
# que ningún checkout tiene. El check falla si al wheel le falta un solo módulo de las once.
- run: uv build --package pinecall --wheel --out-dir dist
working-directory: runtime
- run: uv run --no-project python scripts/check_wheel.py dist/pinecall-*.whl
working-directory: runtime
- uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1
with:
packages-dir: runtime/dist
skip-existing: true # idempotente: relanzar el workflow no es un error