dist.yml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. name: dist
  2. # Compila app/dist en CI y lo publica como asset de la prerelease "dist-latest"
  3. # (el CT 226 tiene 512MB y no puede compilar; el updater descarga el build
  4. # exacto de su commit: app-dist-<sha>.tar.gz).
  5. on:
  6. push:
  7. branches: [main]
  8. # #1271: SIN filtro de paths. El updater rolling descarga el snapshot de
  9. # su commit exacto: si un push solo-Go no genera snapshot, el updater
  10. # aplica uno viejo desalineado (le paso con main en 4b0718c y el artifact
  11. # de 1a9db42).
  12. workflow_dispatch:
  13. jobs:
  14. build:
  15. runs-on: ubuntu-latest
  16. permissions:
  17. contents: write # publicar assets en la prerelease dist-latest
  18. steps:
  19. - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
  20. - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
  21. with:
  22. node-version: 24
  23. cache: npm
  24. cache-dependency-path: app/package-lock.json
  25. - name: Build frontend
  26. working-directory: app
  27. run: npm ci --no-audit --no-fund && npm run build
  28. - name: Empaqueta dist
  29. run: tar czf app-dist-${{ github.sha }}.tar.gz -C app/dist .
  30. - name: Publica en prerelease dist-latest
  31. uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2.6.2
  32. with:
  33. tag_name: dist-latest
  34. name: dist-latest
  35. prerelease: true
  36. files: app-dist-${{ github.sha }}.tar.gz
  37. - name: Limpia assets antiguos (conserva los 5 más recientes por fecha)
  38. env:
  39. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  40. run: |
  41. gh api repos/${{ github.repository }}/releases/tags/dist-latest \
  42. --jq '.assets | sort_by(.created_at) | reverse | .[5:] | .[].name' \
  43. | while read -r a; do gh release delete-asset dist-latest "$a" -y; done