diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 3b1acda..9dba99a 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -5,7 +5,6 @@ on: branches: [ "main" ] env: - IMAGE_NAME: costco-grocery-list REGISTRY: git.nicosaya.com jobs: @@ -21,28 +20,54 @@ jobs: with: node-version: 20 + # ------------------------- + # 🔹 BACKEND TESTS + # ------------------------- - name: Install backend dependencies working-directory: backend run: npm ci - - name: Run tests (if any) + - name: Run backend tests working-directory: backend run: npm test --if-present + # ------------------------- + # 🔹 Docker Login + # ------------------------- - name: Docker login run: | echo "${{ secrets.REGISTRY_PASS }}" | docker login $REGISTRY \ -u "${{ secrets.REGISTRY_USER }}" --password-stdin - - name: Build Docker image + # ------------------------- + # 🔹 Build Backend Image + # ------------------------- + - name: Build Backend Image run: | - docker build -t $REGISTRY/${{ env.IMAGE_NAME }}:${{ github.sha }} . - docker tag $REGISTRY/${{ env.IMAGE_NAME }}:${{ github.sha }} $REGISTRY/${{ env.IMAGE_NAME }}:latest + docker build \ + -t $REGISTRY/costco-backend:${{ github.sha }} \ + -t $REGISTRY/costco-backend:latest \ + -f backend/Dockerfile backend/ - - name: Push Docker image + - name: Push Backend Image run: | - docker push $REGISTRY/${{ env.IMAGE_NAME }}:${{ github.sha }} - docker push $REGISTRY/${{ env.IMAGE_NAME }}:latest + docker push $REGISTRY/costco-backend:${{ github.sha }} + docker push $REGISTRY/costco-backend:latest + + # ------------------------- + # 🔹 Build Frontend Image + # ------------------------- + - name: Build Frontend Image + run: | + docker build \ + -t $REGISTRY/costco-frontend:${{ github.sha }} \ + -t $REGISTRY/costco-frontend:latest \ + -f frontend/Dockerfile frontend/ + + - name: Push Frontend Image + run: | + docker push $REGISTRY/costco-frontend:${{ github.sha }} + docker push $REGISTRY/costco-frontend:latest deploy: needs: build