Skip to content

Commit

Permalink
update github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Ampa1R committed Nov 12, 2023
1 parent 19e8c79 commit c93d2fc
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Deploy Production
on:
workflow_dispatch:
inputs:
choice:
bot:
type: choice
description: Bot
options:
Expand All @@ -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 }};
'

0 comments on commit c93d2fc

Please sign in to comment.