Skip to content

Commit

Permalink
Merge branch 'frontend' into 'main' from pull request #42
Browse files Browse the repository at this point in the history
#34 Изменение frontend пайплайнов для тестов CI/CD
  • Loading branch information
NikitaBuffy authored Dec 10, 2024
2 parents 82306b9 + a71bd72 commit ed3e8ae
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 49 deletions.
43 changes: 2 additions & 41 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: Frontend CI/CD
name: Frontend CI

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

jobs:
Expand Down Expand Up @@ -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:
Expand All @@ -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
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
30 changes: 30 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
with:
Expand Down
8 changes: 0 additions & 8 deletions frontend/src/components/HelloWorld.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
Expand Down

0 comments on commit ed3e8ae

Please sign in to comment.