Fix runner image workflow: lowercase owner and GHCR push #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build & Docker Validation | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - Dev | ||
| -week02-devops | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| - Dev | ||
| -week02-devops | ||
| jobs: | ||
| # Frontend Build Job | ||
| frontend-build: | ||
| name: Frontend Build | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| cache: 'npm' | ||
| cache-dependency-path: 'frontend/package-lock.json' | ||
| - name: Install dependencies | ||
| working-directory: ./frontend | ||
| run: npm install | ||
| - name: Run linter | ||
| working-directory: ./frontend | ||
| run: npm run lint --max-warnings=0 | ||
| continue-on-error: true | ||
| - name: Build frontend | ||
| working-directory: ./frontend | ||
| run: npm run build | ||
| - name: Upload build artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: frontend-build | ||
| path: frontend/.next | ||
| retention-days: 5 | ||
| # Backend Build Job | ||
| backend-build: | ||
| name: Backend Build | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '18' | ||
| cache: 'npm' | ||
| cache-dependency-path: 'backend/package-lock.json' | ||
| - name: Install dependencies | ||
| working-directory: ./backend | ||
| run: npm install | ||
| - name: Run linter | ||
| working-directory: ./backend | ||
| run: npm run lint | ||
| - name: Build backend | ||
| working-directory: ./backend | ||
| run: npm run build | ||
| - name: Run tests | ||
| working-directory: ./backend | ||
| run: npm run test -- --passWithNoTests | ||
| - name: Upload build artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: backend-build | ||
| path: backend/dist | ||
| retention-days: 5 | ||
| # Docker Build Validation for Backend | ||
| docker-backend-build: | ||
| name: Docker Build Validation - Backend | ||
| runs-on: ubuntu-latest | ||
| needs: backend-build | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Build backend Docker image | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: ./backend | ||
| file: ./backend/Dockerfile | ||
| push: false | ||
| tags: nebulacode/backend:latest | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
| # Docker Build Validation for Frontend | ||
| docker-frontend-build: | ||
| name: Docker Build Validation - Frontend | ||
| runs-on: ubuntu-latest | ||
| needs: frontend-build | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Build frontend Docker image | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: ./frontend | ||
| file: ./frontend/Dockerfile | ||
| push: false | ||
| tags: nebulacode/frontend:latest | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
| # Docker Compose Validation (Optional but recommended) | ||
| docker-compose-validation: | ||
| name: Docker Compose Configuration Validation | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Validate docker-compose.yml | ||
| run: docker-compose config -q | ||