| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- name: release
- # Release estable por tag v*: goreleaser construye netpulse (con el frontend
- # embebido) y netpulse-collector para linux/amd64|arm64|armv7 + checksums.txt.
- # install.sh / install-collector.sh consumen estos assets.
- # Distinto de go.yml: aquello publica binarios rolling del commit en la
- # prerelease go-latest (para el updater del CT 226); esto publica versiones.
- on:
- push:
- tags: ['v*']
- workflow_dispatch: # sin tag = snapshot de prueba (no publica release)
- permissions:
- contents: write
- jobs:
- release:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - uses: actions/setup-node@v4
- with:
- node-version: 22
- cache: npm
- cache-dependency-path: app/package-lock.json
- - uses: actions/setup-go@v5
- with:
- go-version: '1.26'
- cache-dependency-path: |
- server-go/go.sum
- collector/go.sum
- - name: Build frontend + copia dist al embed (necesario para go:embed y tests)
- run: |
- npm ci --no-audit --no-fund --prefix app
- npm run build --prefix app
- rm -rf server-go/internal/staticspa/dist && cp -r app/dist server-go/internal/staticspa/dist
- - name: Tests Go (ambos módulos)
- run: |
- (cd server-go && go test ./...)
- (cd collector && go test ./...)
- - name: Build agent binaries para embed (todas las arquitecturas)
- env:
- CGO_ENABLED: 0
- GOOS: linux
- run: |
- set -e
- # amd64
- (cd agent && GOARCH=amd64 go build -trimpath -ldflags "-s -w" -o ../server-go/internal/agentbin/agents/netpulse-agent-amd64 ./cmd/netpulse-agent)
- # arm64
- (cd agent && GOARCH=arm64 go build -trimpath -ldflags "-s -w" -o ../server-go/internal/agentbin/agents/netpulse-agent-arm64 ./cmd/netpulse-agent)
- # armv7
- (cd agent && GOARCH=arm GOARM=7 go build -trimpath -ldflags "-s -w" -o ../server-go/internal/agentbin/agents/netpulse-agent-armv7 ./cmd/netpulse-agent)
- - name: Valida config goreleaser
- uses: goreleaser/goreleaser-action@v6
- with:
- version: '~> v2'
- args: check
- - name: Release (tag v* — publica)
- if: github.ref_type == 'tag'
- uses: goreleaser/goreleaser-action@v6
- with:
- version: '~> v2'
- args: release --clean
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- - name: Release (workflow_dispatch — snapshot sin publicar)
- if: github.ref_type != 'tag'
- uses: goreleaser/goreleaser-action@v6
- with:
- version: '~> v2'
- args: release --clean --snapshot
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|