diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml index 422dc40..bd19d89 100644 --- a/.github/workflows/backend.yml +++ b/.github/workflows/backend.yml @@ -1,4 +1,4 @@ -name: Java CI +name: Backend CI on: pull_request: @@ -33,12 +33,6 @@ jobs: cd backend mvn clean verify - - name: Upload backend build artifact - uses: actions/upload-artifact@v4 - with: - name: backend-jar - path: /backend/target/*.jar - - name: Cache SonarQube packages uses: actions/cache@v4 with: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ba1cd02..2ebba30 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: Main CD +name: CI/CD remote on: pull_request: @@ -16,6 +16,12 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -25,19 +31,18 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Download Backend Artifact - uses: actions/download-artifact@v4 - with: - name: backend-jar - path: backend/target/ + - name: Build backend + run: | + cd backend + mvn clean package - - name: Build and Push Backend Image + - name: Build and push backend image run: | cd backend docker build -t nickpominov/lm-backend:latest . docker push nickpominov/lm-backend:latest - - name: Deploy Backend to Remote Server + - name: Deploy backend to remote server uses: appleboy/ssh-action@v0.1.7 with: host: ${{ secrets.SERVER_IP }} @@ -46,6 +51,7 @@ jobs: port: 22 script: | cd /srv/lenka-messenger + docker-compose -f docker-compose.prod.yaml pull lm-backend docker-compose -f docker-compose.prod.yaml up -d --no-deps lm-backend cd-frontend: @@ -95,4 +101,5 @@ jobs: port: 22 script: | cd /srv/lenka-messenger + docker-compose -f docker-compose.prod.yaml pull lm-frontend docker-compose -f docker-compose.prod.yaml up -d --no-deps lm-frontend \ No newline at end of file