diff --git a/.github/workflows/pr_closed.yml b/.github/workflows/pr_closed.yml new file mode 100644 index 00000000..4d08a068 --- /dev/null +++ b/.github/workflows/pr_closed.yml @@ -0,0 +1,84 @@ +name: PR_CLOSED DEPLOY AND TG ALERT + +on: + pull_request: + types: [closed] + branches: + - main + + +jobs: + build_and_push_to_docker_hub: + name: Push Docker image to Docker Hub + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to Docker + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Push to Docker Hub + uses: docker/build-push-action@v2 + with: + push: true + tags: lapkipomoshi/help_paw_f:latest + + deploy: + runs-on: ubuntu-latest + needs: build_and_push_to_docker_hub + steps: + - name: executing remote ssh commands to deploy + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USER }} + password: ${{ secrets.PASSWORD }} + script: | + cd ~/test + sudo docker-compose stop + rm .env + touch .env + echo DB_ENGINE=${{ secrets.DB_ENGINE }} >> .env + echo DB_NAME=${{ secrets.DB_NAME }} >> .env + echo POSTGRES_USER=${{ secrets.POSTGRES_USER }} >> .env + echo POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }} >> .env + echo DB_HOST=${{ secrets.DB_HOST }} >> .env + echo DB_PORT=${{ secrets.DB_PORT }} >> .env + echo D_KEY=${{ secrets.D_KEY }} >> .env + echo LOCAL=${{ secrets.LOCAL }} >> .env + echo BOT=${{ secrets.BOT }} >> .env + echo ALERT_CHANNEL=${{ secrets.ALERT_CHANNEL }} >> .env + echo EMAIL_HOST=${{ secrets.EMAIL_HOST }} >> .env + echo EMAIL_PORT=${{ secrets.EMAIL_PORT }} >> .env + echo EMAIL_HOST_USER=${{ secrets.EMAIL_HOST_USER }} >> .env + echo EMAIL_HOST_PASSWORD=${{ secrets.EMAIL_HOST_PASSWORD }} >> .env + echo EMAIL_USE_SSL=${{ secrets.EMAIL_USE_SSL }} >> .env + echo EMAIL_USE_TLS=${{ secrets.EMAIL_USE_TLS }} >> .env + echo DEBUG=${{ secrets.DEBUG }} >> .env + echo EMAIL_BACKEND_TYPE=${{ secrets.EMAIL_BACKEND_TYPE }} >> .env + sudo docker-compose pull + sudo docker-compose up -d + + send_message: + runs-on: ubuntu-latest + needs: deploy + steps: + - name: send message + if: github.event.pull_request.merged == true + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.ALERT_CHANNEL }} + token: ${{ secrets.BOT }} + message: FRONTEND - ${{ github.event_name }} ветки ${{ github.head_ref }} успешно смержен в ${{ github.base_ref }}, LAPKIPOMOSHI.RU обновлен и перезапущен + - name: send message merged + if: github.event.pull_request.merged == false + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.ALERT_CHANNEL }} + token: ${{ secrets.BOT }} + message: FRONTEND - ${{ github.event_name }} ветки ${{ github.head_ref }} в ${{ github.base_ref }} закрыт без мержа, деплой не производился. diff --git a/.github/workflows/pr_closed_test.yml b/.github/workflows/pr_closed_test.yml new file mode 100644 index 00000000..23205c2b --- /dev/null +++ b/.github/workflows/pr_closed_test.yml @@ -0,0 +1,85 @@ +name: PR_CLOSED DEPLOY AND TG ALERT + +on: + pull_request: + types: [closed] + branches: + - test + + +jobs: + build_and_push_to_docker_hub: + name: Push Docker image to Docker Hub + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to Docker + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Push to Docker Hub + uses: docker/build-push-action@v2 + with: + push: true + tags: lapkipomoshi/help_paw_f:test + + deploy: + runs-on: ubuntu-latest + needs: build_and_push_to_docker_hub + steps: + - name: executing remote ssh commands to deploy + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.TEST_HOST }} + username: ${{ secrets.USER }} + password: ${{ secrets.PASSWORD }} + script: | + cd ~/test + sudo docker-compose stop + rm .env + touch .env + echo DB_ENGINE=${{ secrets.DB_ENGINE }} >> .env + echo DB_NAME=${{ secrets.DB_NAME }} >> .env + echo POSTGRES_USER=${{ secrets.POSTGRES_USER }} >> .env + echo POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }} >> .env + echo DB_HOST=${{ secrets.DB_HOST }} >> .env + echo DB_PORT=${{ secrets.DB_PORT }} >> .env + echo D_KEY=${{ secrets.D_KEY }} >> .env + echo LOCAL=${{ secrets.LOCAL }} >> .env + echo BOT=${{ secrets.BOT }} >> .env + echo ALERT_CHANNEL=${{ secrets.ALERT_CHANNEL }} >> .env + echo EMAIL_HOST=${{ secrets.EMAIL_HOST }} >> .env + echo EMAIL_PORT=${{ secrets.EMAIL_PORT }} >> .env + echo EMAIL_HOST_USER=${{ secrets.EMAIL_HOST_USER }} >> .env + echo EMAIL_HOST_PASSWORD=${{ secrets.EMAIL_HOST_PASSWORD }} >> .env + echo EMAIL_USE_SSL=${{ secrets.EMAIL_USE_SSL }} >> .env + echo EMAIL_USE_TLS=${{ secrets.EMAIL_USE_TLS }} >> .env + echo DEBUG=${{ secrets.TEST_DEBUG }} >> .env + echo EMAIL_BACKEND_TYPE=${{ secrets.EMAIL_BACKEND_TYPE }} >> .env + echo REACT_APP_SERVER_TYPE=${{ secrets.REACT_APP_SERVER_TYPE_TEST }} >> .env + sudo docker-compose pull + sudo docker-compose up -d + + send_message: + runs-on: ubuntu-latest + needs: deploy + steps: + - name: send message + if: github.event.pull_request.merged == true + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.ALERT_CHANNEL }} + token: ${{ secrets.BOT }} + message: FRONTEND - ${{ github.event_name }} ветки ${{ github.head_ref }} успешно смержен в ${{ github.base_ref }}, TEST обновлен и перезапущен + - name: send message merged + if: github.event.pull_request.merged == false + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.ALERT_CHANNEL }} + token: ${{ secrets.BOT }} + message: FRONTEND - ${{ github.event_name }} ветки ${{ github.head_ref }} в ${{ github.base_ref }} закрыт без мержа, деплой не производился. diff --git a/.github/workflows/pr_opened.yml b/.github/workflows/pr_opened.yml new file mode 100644 index 00000000..a9b423d0 --- /dev/null +++ b/.github/workflows/pr_opened.yml @@ -0,0 +1,19 @@ +name: PR_OPENED TG ALERT + +on: + pull_request: + types: [opened] + branches: + - main + - test + +jobs: + send_message: + runs-on: ubuntu-latest + steps: + - name: send message + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.ALERT_CHANNEL }} + token: ${{ secrets.BOT }} + message: FRONTEND - ${{ github.actor }} открыл ${{ github.event_name }} ветки ${{ github.head_ref }} в ${{ github.base_ref }} diff --git a/src/components/CardsSlider/CardsSlider.jsx b/src/components/CardsSlider/CardsSlider.jsx index 63ffcb79..fabf5c2d 100644 --- a/src/components/CardsSlider/CardsSlider.jsx +++ b/src/components/CardsSlider/CardsSlider.jsx @@ -1,7 +1,7 @@ import React, { useRef } from 'react'; import './CardsSlider.scss'; -const CardsSlider = ({ children, isButtonsHidden = false }) => { +const CardsSlider = ({ children, isButtonsHidden = false, modifier }) => { const defaultScrollPixelsAmount = 350; const sliderContainerRef = useRef(null); @@ -16,10 +16,10 @@ const CardsSlider = ({ children, isButtonsHidden = false }) => { return ( <> -