diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index aedb0a0..f974a1c 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -7,10 +7,6 @@ on: pull_request: branches: [main] -env: - REGISTRY: git.datadunia.com - IMAGE_PREFIX: ${{ github.repository }} - jobs: # ────────────────────────────────────────────── # TEST — all 3 components in parallel @@ -47,7 +43,7 @@ jobs: - name: Test run: go test ./... -cover - dashboard-ui-build: + dashboard-test: runs-on: ubuntu-latest defaults: run: @@ -62,11 +58,11 @@ jobs: node-version: '24' - name: Install run: npm ci || npm install - - name: Type check & Build + - name: Build run: npm run build # ────────────────────────────────────────────── - # BUILD GO BINARIES (server-core + device-agent) + # BUILD — binaries + frontend dist # ────────────────────────────────────────────── server-core-build: runs-on: ubuntu-latest @@ -124,65 +120,35 @@ jobs: name: nexus-device-agent-${{ matrix.goos }}-${{ matrix.goarch }} path: apps/device-agent/bin/nexus-device-agent-* - # ────────────────────────────────────────────── - # DOCKER — build & push (main + tags only) - # ────────────────────────────────────────────── - docker-build-push: + dashboard-dist: runs-on: ubuntu-latest - needs: [server-core-build, dashboard-ui-build] - if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/tags/dev-') - strategy: - matrix: - include: - - name: server-core - context: apps/server-core - image: nexusguard-server-core - - name: dashboard-ui - context: apps/dashboard-ui - image: nexusguard-dashboard-ui - build-args: | - VITE_API_BASE_URL=${{ vars.VITE_API_BASE_URL }} + needs: dashboard-test + defaults: + run: + working-directory: apps/dashboard-ui steps: - uses: actions/checkout@v4 with: submodules: true - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to Gitea Container Registry - uses: docker/login-action@v3 + - uses: actions/setup-node@v4 with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITEA_TOKEN }} - - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 + node-version: '24' + - name: Install + run: npm ci || npm install + - name: Build + run: npm run build + - name: Upload dist + uses: actions/upload-artifact@v4 with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/${{ matrix.image }} - tags: | - type=raw,value=latest,enable={{is_default_branch}} - type=ref,event=tag - type=sha,prefix= - - - name: Build and push - uses: docker/build-push-action@v6 - with: - context: ${{ matrix.context }} - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max + name: dashboard-ui-dist + path: apps/dashboard-ui/dist/ # ────────────────────────────────────────────── - # RELEASE — annotated tag + artifacts + # RELEASE — tag v* only # ────────────────────────────────────────────── release: runs-on: ubuntu-latest - needs: [docker-build-push, device-agent-cross-build] + needs: [server-core-build, device-agent-cross-build, dashboard-dist] if: startsWith(github.ref, 'refs/tags/v') permissions: contents: write @@ -199,9 +165,14 @@ jobs: - name: Prepare release assets run: | mkdir -p release/ + # Device agent binaries cp artifacts/nexus-device-agent-*/nexus-device-agent-* release/ 2>/dev/null || true + # Server core binary cp artifacts/server-core-linux-amd64/server-core release/nexus-server-core-linux-amd64 || true chmod +x release/nexus-server-core-linux-amd64 + # Dashboard dist (zip) + cd artifacts/dashboard-ui-dist && tar czf ../../release/nexusguard-dashboard-ui.tar.gz . && cd ../.. + # Checksums cd release && sha256sum * > checksums-sha256.txt - name: Create GitHub Release