From c93d2fca0b46abf8a107dad42ca140faa3e83769 Mon Sep 17 00:00:00 2001 From: Filipp Vasilev Date: Mon, 13 Nov 2023 02:54:04 +0400 Subject: [PATCH] update github workflow --- .github/workflows/deploy.yml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b594b47ea..2e3d05103 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,7 +3,7 @@ name: Deploy Production on: workflow_dispatch: inputs: - choice: + bot: type: choice description: Bot options: @@ -24,20 +24,22 @@ jobs: run: ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts - name: Copy sources to server - run: rsync -avz ./ root@${{ secrets.SSH_HOST }}:/home/ci/apps/evobot_${{ github.event.inputs.choice }}_fresh + run: rsync -avz ./ root@${{ secrets.SSH_HOST }}:/home/ci/apps/evobot_${{ github.event.inputs.bot }}_fresh - name: Build & run application + env: + METRICS_PORT: ${{ fromJSON('{"mozart":"9100","wagner":"9200"}')[github.event.inputs.bot] }} run: >- ssh root@${{ secrets.SSH_HOST }} ' uptime; cd /home/ci/apps; - rm -rf evobot_${{ github.event.inputs.choice }}_prev; - mv evobot_${{ github.event.inputs.choice }} evobot_${{ github.event.inputs.choice }}_prev; - mv evobot_${{ github.event.inputs.choice }}_fresh evobot_${{ github.event.inputs.choice }}; - cp envs/evobot_${{ github.event.inputs.choice }}.config.json evobot_${{ github.event.inputs.choice }}/config.json; - cd evobot_${{ github.event.inputs.choice }}; - docker stop ${{ github.event.inputs.choice }}; - docker rm ${{ github.event.inputs.choice }}; - docker build --no-cache -t evobot:${{ github.event.inputs.choice }} .; - docker run -d --name=${{ github.event.inputs.choice }} evobot:${{ github.event.inputs.choice }}; + rm -rf evobot_${{ github.event.inputs.bot }}_prev; + mv evobot_${{ github.event.inputs.bot }} evobot_${{ github.event.inputs.bot }}_prev; + mv evobot_${{ github.event.inputs.bot }}_fresh evobot_${{ github.event.inputs.bot }}; + cp envs/evobot_${{ github.event.inputs.bot }}.config.json evobot_${{ github.event.inputs.bot }}/config.json; + cd evobot_${{ github.event.inputs.bot }}; + docker build --no-cache -t evobot:${{ github.event.inputs.bot }} .; + docker stop ${{ github.event.inputs.bot }}; + docker rm ${{ github.event.inputs.bot }}; + docker run -d -p 127.0.0.1:${{ env.METRICS_PORT }}:3000 --name=${{ github.event.inputs.bot }} --restart=always evobot:${{ github.event.inputs.bot }}; '