From 00127fbd98613a636a064e304423a6569f92331b Mon Sep 17 00:00:00 2001 From: SBCrumb Date: Tue, 9 Sep 2025 15:02:48 -0400 Subject: [PATCH] update --- .gitea/workflows/ci.yml | 98 ++++++++++++----------------------------- 1 file changed, 27 insertions(+), 71 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 0f21f77..ce5f50d 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI/CD Pipeline +name: Docker Build & Deploy on: push: @@ -7,15 +7,13 @@ on: branches: [ main ] jobs: - test: + build: runs-on: host steps: - name: Checkout code run: | echo "Current workspace: $(pwd)" - echo "Available files:" - ls -la # Clone the repository since Gitea runner doesn't auto-checkout echo "Cloning repository..." @@ -24,83 +22,41 @@ jobs: cp -r /tmp/repo/.* . 2>/dev/null || true rm -rf /tmp/repo - echo "After checkout:" + echo "Repository cloned successfully" ls -la - echo "Backend directory:" - ls -la backend/ 2>/dev/null || echo "backend directory not found" - echo "Frontend directory:" - ls -la frontend/ 2>/dev/null || echo "frontend directory not found" - - name: Check Node.js version + - name: Build Docker image run: | - which node || echo "Node.js not found in PATH" - node --version || echo "Node.js not available" - which npm || echo "npm not found in PATH" - npm --version || echo "npm not available" + echo "Building Docker image..." + docker build -t nfoguard:latest . + docker tag nfoguard:latest nfoguard:${{ github.sha }} + echo "Docker image built successfully" - - name: Install backend dependencies + - name: Push to registry (if main branch) + if: github.ref == 'refs/heads/main' run: | - if [ -d "backend" ]; then - cd backend - npm ci - else - echo "Backend directory not found, skipping backend dependencies" - exit 1 - fi - - - name: Run backend tests - env: - DATABASE_URL: postgresql://postgres:postgres@localhost:5432/nfoguard_test - JWT_SECRET: test-secret-key-for-ci - NODE_ENV: test - run: | - if [ -d "backend" ]; then - cd backend - npm run test - else - echo "Backend directory not found, skipping backend tests" - exit 1 - fi - - - name: Install frontend dependencies - run: | - if [ -d "frontend" ]; then - cd frontend - npm ci - else - echo "Frontend directory not found, skipping frontend dependencies" - exit 1 - fi - - - name: Run frontend tests - run: | - if [ -d "frontend" ]; then - cd frontend - npm run test - else - echo "Frontend directory not found, skipping frontend tests" - exit 1 - fi - - - name: Build frontend - run: | - if [ -d "frontend" ]; then - cd frontend - npm run build - else - echo "Frontend directory not found, skipping frontend build" - exit 1 - fi + echo "Pushing Docker image to registry..." + # Add your registry push commands here + # Examples: + # docker tag nfoguard:latest your-registry.com/nfoguard:latest + # docker push your-registry.com/nfoguard:latest + # docker push your-registry.com/nfoguard:${{ github.sha }} + echo "Image ready for deployment" deploy: - needs: test + needs: build runs-on: host if: github.ref == 'refs/heads/main' steps: - name: Deploy application run: | - echo "Deploying to production..." - echo "Current directory: $(pwd)" - echo "Available files:" - ls -la \ No newline at end of file + echo "Deploying application..." + # Add your deployment commands here + # Examples: + # docker-compose pull + # docker-compose up -d + # or + # docker stop nfoguard || true + # docker run -d --name nfoguard -p 8080:8080 nfoguard:latest + echo "Deployment completed" \ No newline at end of file