dist.yml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. paths:
  9. - 'app/**'
  10. - '.github/workflows/dist.yml'
  11. workflow_dispatch:
  12. jobs:
  13. build:
  14. runs-on: ubuntu-latest
  15. permissions:
  16. contents: write # publicar assets en la prerelease dist-latest
  17. steps:
  18. - uses: actions/checkout@v4
  19. - uses: actions/setup-node@v4
  20. with:
  21. node-version: 24
  22. cache: npm
  23. cache-dependency-path: app/package-lock.json
  24. - name: Build frontend
  25. working-directory: app
  26. run: npm ci --no-audit --no-fund && npm run build
  27. - name: Empaqueta dist
  28. run: tar czf app-dist-${{ github.sha }}.tar.gz -C app/dist .
  29. - name: Publica en prerelease dist-latest
  30. uses: softprops/action-gh-release@v2
  31. with:
  32. tag_name: dist-latest
  33. name: dist-latest
  34. prerelease: true
  35. files: app-dist-${{ github.sha }}.tar.gz
  36. - name: Limpia assets antiguos (conserva los 5 más recientes por fecha)
  37. env:
  38. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  39. run: |
  40. gh api repos/${{ github.repository }}/releases/tags/dist-latest \
  41. --jq '.assets | sort_by(.created_at) | reverse | .[5:] | .[].name' \
  42. | while read -r a; do gh release delete-asset dist-latest "$a" -y; done