| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- name: dist
- # Compila app/dist en CI y lo publica como asset de la prerelease "dist-latest"
- # (el CT 226 tiene 512MB y no puede compilar; el updater descarga el build
- # exacto de su commit: app-dist-<sha>.tar.gz).
- on:
- push:
- branches: [main]
- paths:
- - 'app/**'
- - '.github/workflows/dist.yml'
- workflow_dispatch:
- jobs:
- build:
- runs-on: ubuntu-latest
- permissions:
- contents: write # publicar assets en la prerelease dist-latest
- steps:
- - uses: actions/checkout@v4
- - uses: actions/setup-node@v4
- with:
- node-version: 22
- cache: npm
- cache-dependency-path: app/package-lock.json
- - name: Build frontend
- working-directory: app
- run: npm ci --no-audit --no-fund && npm run build
- - name: Empaqueta dist
- run: tar czf app-dist-${{ github.sha }}.tar.gz -C app/dist .
- - name: Publica en prerelease dist-latest
- uses: softprops/action-gh-release@v2
- with:
- tag_name: dist-latest
- name: dist-latest
- prerelease: true
- files: app-dist-${{ github.sha }}.tar.gz
- - name: Limpia assets antiguos (conserva los 5 más recientes por fecha)
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
- gh api repos/${{ github.repository }}/releases/tags/dist-latest \
- --jq '.assets | sort_by(.created_at) | reverse | .[5:] | .[].name' \
- | while read -r a; do gh release delete-asset dist-latest "$a" -y; done
|