forked from eritislami/evobot
-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (40 loc) · 1.62 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: Deploy Production
on:
workflow_dispatch:
inputs:
choice:
type: choice
description: Bot
options:
- mozart
- wagner
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: "just-a-placeholder-so-we-dont-get-errors"
- name: Adding Known Hosts
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
- name: Build & run application
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 }};
'