release.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. name: release
  2. # Release estable por tag v*: goreleaser construye netpulse (con el frontend
  3. # embebido) y netpulse-collector para linux/amd64|arm64|armv7 + checksums.txt.
  4. # install.sh / install-collector.sh consumen estos assets.
  5. # Distinto de go.yml: aquello publica binarios rolling del commit en la
  6. # prerelease go-latest (para el updater del CT 226); esto publica versiones.
  7. on:
  8. push:
  9. tags: ['v*']
  10. workflow_dispatch: # sin tag = snapshot de prueba (no publica release)
  11. permissions:
  12. contents: write
  13. jobs:
  14. release:
  15. runs-on: ubuntu-latest
  16. steps:
  17. - uses: actions/checkout@v4
  18. - uses: actions/setup-node@v4
  19. with:
  20. node-version: 22
  21. cache: npm
  22. cache-dependency-path: app/package-lock.json
  23. - uses: actions/setup-go@v5
  24. with:
  25. go-version: '1.26'
  26. cache-dependency-path: |
  27. server-go/go.sum
  28. collector/go.sum
  29. - name: Build frontend + copia dist al embed (necesario para go:embed y tests)
  30. run: |
  31. npm ci --no-audit --no-fund --prefix app
  32. npm run build --prefix app
  33. rm -rf server-go/internal/staticspa/dist && cp -r app/dist server-go/internal/staticspa/dist
  34. - name: Tests Go (ambos módulos)
  35. run: |
  36. (cd server-go && go test ./...)
  37. (cd collector && go test ./...)
  38. - name: Valida config goreleaser
  39. uses: goreleaser/goreleaser-action@v6
  40. with:
  41. version: '~> v2'
  42. args: check
  43. - name: Release (tag v* — publica)
  44. if: github.ref_type == 'tag'
  45. uses: goreleaser/goreleaser-action@v6
  46. with:
  47. version: '~> v2'
  48. args: release --clean
  49. env:
  50. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  51. - name: Release (workflow_dispatch — snapshot sin publicar)
  52. if: github.ref_type != 'tag'
  53. uses: goreleaser/goreleaser-action@v6
  54. with:
  55. version: '~> v2'
  56. args: release --clean --snapshot
  57. env:
  58. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}