Skip to content

Commit

Permalink
Merge branch 'devops_7' into 'devops' from pull request #37
Browse files Browse the repository at this point in the history
#7 Изменения пайплайнов frontend и пуша в main ветку
  • Loading branch information
NikitaBuffy authored Dec 10, 2024
2 parents 6328fa9 + 81a5af0 commit c0fb8bf
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 24 deletions.
37 changes: 35 additions & 2 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Vue CI
name: Frontend CI/CD

on:
pull_request:
branches:
- frontend
push:
branches:
- frontend
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -63,4 +66,34 @@ 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
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
23 changes: 1 addition & 22 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,28 +56,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- 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: Download Frontend Artifact
uses: actions/download-artifact@v4
with:
name: frontend-dist
path: frontend/dist/

- 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
- name: Deploy frontend to remote server
uses: appleboy/[email protected]
with:
host: ${{ secrets.SERVER_IP }}
Expand Down

0 comments on commit c0fb8bf

Please sign in to comment.