-
Notifications
You must be signed in to change notification settings - Fork 2
65 lines (61 loc) · 1.97 KB
/
automated_api_stable_deploy.yaml
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Deploy Astroid API update via Github Actions
on:
workflow_dispatch:
release:
types: [published]
jobs:
stop_api:
runs-on: ubuntu-latest
steps:
- name: API Shutdown
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
script: |
sudo systemctl stop astroidapi
backup_api:
runs-on: ubuntu-latest
needs: stop_api
steps:
- name: Backup API image
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
script: |
cp -r /root/guildcord/src/astroidapi /root/backup/guildcord/src
cp -r /root/guildcord/src/api.py /root/backup/guildcord/src
update_api:
runs-on: ubuntu-latest
needs: [stop_api, backup_api]
steps:
- name: Pull changes
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
script: |
cd /root/astroid
git pull origin main
cp -r /root/astroid/src/astroidapi /root/guildcord/src
cp -r /root/astroid/src/api.py /root/guildcord/src
deploy_api:
runs-on: ubuntu-latest
needs: [stop_api, update_api, backup_api]
steps:
- name: Deploy API
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
script: |
sudo systemctl start astroidapi