From 04a3151e61ddfc1475d3fddd2b98ccc0b9a1ce92 Mon Sep 17 00:00:00 2001 From: omelchenkopeter Date: Sat, 16 Sep 2023 10:14:51 +0300 Subject: [PATCH] build_and_push_frontend_and_workflow --- .github/workflows/main.yml | 71 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 827cc1d30f..4009bb2cad 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -88,3 +88,74 @@ jobs: # устанавливаем тег latest, чтобы потом # на сервере и в docker-compose.yml не указывать версию tags: back4up/taski_backend:latest + + + + + frontend_tests: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up nodeJS + # Это готовый воркфлоу для установки Node.js на раннер + uses: actions/setup-node@v3 + with: + # Это параметр воркфлоу, указывающий нужную версию Node.js + node-version: 18 + + - name: Install dependencies + # Эта команда устанавливает зависимости для фронтенда + run: | + cd frontend/ + npm ci + + - name: Test frontend + # Запускаем тесты + run: | + cd frontend/ + npm run test + build_frontend_and_push_to_docker_hub: + name: Push frontend Docker image to DockerHub + runs-on: ubuntu-latest + needs: frontend_tests + steps: + - name: Check out the repo + uses: actions/checkout@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to Docker + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Push to DockerHub + uses: docker/build-push-action@v4 + with: + context: ./frontend/ + push: true + tags: back4up/taski_frontend:latest + + + + + build_gateway_and_push_to_docker_hub: + name: Push gateway Docker image to DockerHub + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to Docker + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Push to DockerHub + uses: docker/build-push-action@v4 + with: + context: ./gateway/ + push: true + # Тут вместо username должен быть ваш логин на Docker Hub + tags: back4up/taski_gateway:latest