-
-
Notifications
You must be signed in to change notification settings - Fork 54
executable file
·58 lines (49 loc) · 1.58 KB
/
main.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Backend CI/CD
on:
push:
branches: [main]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.x'
deploy:
runs-on: ubuntu-latest
needs: build-and-test
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: SSH and Restart EU Server
uses: appleboy/[email protected]
with:
host: ${{ secrets.EU_IP_ADDRESS }}
username: ${{ secrets.EU_USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: |
cd backend/
git reset --hard
git pull https://${{ secrets.GIT_PASSWORD }}:[email protected]/stocknear/backend.git
pm2 restart fastapi
pm2 restart fastify
- name: SSH and Restart USEast Server
uses: appleboy/[email protected]
with:
host: ${{ secrets.USEAST_IP_ADDRESS }}
username: ${{ secrets.USEAST_USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: |
cd backend/
git reset --hard
git pull https://${{ secrets.GIT_PASSWORD }}:[email protected]/stocknear/backend.git
pm2 restart fastapi
pm2 restart fastify
- name: Actions for Discord
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/[email protected]
with:
args: '${{ github.event.repository.full_name }} has been deployed successfully.'