diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 314ccd6..0cba454 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -1,12 +1,9 @@ -name: Frontend CI/CD +name: Frontend CI on: pull_request: branches: - frontend - push: - branches: - - frontend workflow_dispatch: jobs: @@ -40,12 +37,6 @@ jobs: cd frontend npm run build - - name: Upload frontend build artifact - uses: actions/upload-artifact@v4 - with: - name: frontend-dist - path: frontend/dist/ - - name: Set up JDK 17 uses: actions/setup-java@v4 with: @@ -66,34 +57,4 @@ jobs: SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }} run: | cd frontend - npx sonar-scanner -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.projectName='lenka-messenger' -Dsonar.sources=src -Dsonar.pullrequest.key=${{ github.event.number}} -Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} -Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }} -Dsonar.scm.revision=${{ github.event.pull_request.head.sha }} -Dsonar.host.url=$SONAR_HOST_URL - - deploy-to-dockerhub: - if: github.ref == 'refs/heads/frontend' - runs-on: ubuntu-latest - needs: build-and-analyze - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Download frontend build artifact - uses: actions/download-artifact@v4 - with: - name: frontend-dist - path: /frontend/dist - - - name: Log in to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Build and push frontend image - run: | - cd frontend - docker build -t nickpominov/lm-frontend:latest . - docker push nickpominov/lm-frontend:latest \ No newline at end of file + npx sonar-scanner -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.projectName='lenka-messenger' -Dsonar.sources=src -Dsonar.pullrequest.key=${{ github.event.number}} -Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} -Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }} -Dsonar.scm.revision=${{ github.event.pull_request.head.sha }} -Dsonar.host.url=$SONAR_HOST_URL \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7b5162f..ba1cd02 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -56,6 +56,36 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Install frontend dependencies + run: | + cd frontend + npm install + + - name: Build frontend + run: | + cd frontend + npm run build + + - name: Build and push frontend image + run: | + cd frontend + docker build -t nickpominov/lm-frontend:latest . + docker push nickpominov/lm-frontend:latest + - name: Deploy frontend to remote server uses: appleboy/ssh-action@v0.1.7 with: diff --git a/frontend/src/components/HelloWorld.vue b/frontend/src/components/HelloWorld.vue index 5d0eb17..4a2e676 100644 --- a/frontend/src/components/HelloWorld.vue +++ b/frontend/src/components/HelloWorld.vue @@ -11,14 +11,6 @@