From b9e3a8cb7fefda3e592119878ed70366834c25af Mon Sep 17 00:00:00 2001 From: Vlad Chikov Date: Sun, 25 Feb 2024 21:44:09 +0300 Subject: [PATCH] =?UTF-8?q?chore:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20Continuous=20Deployment=20=D0=B2=20=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D0=B5=D0=BA=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/actions.yml | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/actions.yml diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml new file mode 100644 index 0000000..93e1e60 --- /dev/null +++ b/.github/workflows/actions.yml @@ -0,0 +1,37 @@ +name: CD Action +run-name: CD Action in work + +on: # запускать процессы при push и pull_request в ветку main + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + job: # эта часть отвечает за развёртывание приложения + name: Continuous Deployment + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + runs-on: ubuntu-latest + strategy: + matrix: + node-version: ["21.x"] + steps: + - name: Проверяем код репозитория + uses: actions/checkout@v4 + + - name: Настраиваем Node.js версии ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - name: Устанавливаем SSH ключи + run: | + set -eu + mkdir "$HOME/.ssh" + echo "${{ secrets.DEPLOY_SSH_KEY }}" >> "$HOME/.ssh/id_rsa" + chmod 600 "$HOME/.ssh/id_rsa" + + - name: Отправляем код на сервер + run: scp -i $HOME/.ssh/id_rsa -o StrictHostKeyChecking=no -r dist/* ${{ secrets.DEPLOY_SERVER_INFO }}