-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (44 loc) · 1.43 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
44
# name: Deploy to Server
#
# on:
# push:
# branches:
# - main
#
# jobs:
# deploy:
# runs-on: ubuntu-latest
#
# steps:
# - name: Checkout repository
# uses: actions/checkout@v2
#
# - name: Set up Python
# uses: actions/setup-python@v2
# with:
# python-version: '3.9'
#
# - name: Start SSH agent
# uses: webfactory/ssh-agent@v0.5.3
# with:
# ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
#
# - name: Test SSH connection
# run: ssh -o StrictHostKeyChecking=no ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }} 'echo SSH connection successful'
# env:
# SERVER_HOST: ${{ secrets.SERVER_HOST }}
# SERVER_USER: ${{ secrets.SERVER_USER }}
#
# - name: Copy files to server
# run: |
# ssh -o StrictHostKeyChecking=no ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }} "mkdir -p /root/repos/askgbt"
# rsync -avz -e "ssh -o StrictHostKeyChecking=no" . ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }}:/root/repos/askgbt
#
# - name: Restart application on server
# run: |
# ssh -o StrictHostKeyChecking=no ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }} << 'EOF'
# systemctl stop askgbt; systemctl start askgbt
# EOF
# env:
# SERVER_HOST: ${{ secrets.SERVER_HOST }}
# SERVER_USER: ${{ secrets.SERVER_USER }}