-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (31 loc) · 1.13 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
name: Deploy to VPS
on:
push:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.75.0
override: true
- name: build project
run: cargo build --release
- name: install tools
run: sudo apt-get install sshpass rsync
- name: write changes to server
run: |
sshpass -p ${{ secrets.VPS_PASSWORD }} rsync -avz -e 'ssh -o StrictHostKeyChecking=no' target/release/ vishalds@${{ secrets.VPS_HOST }}:/home/vishalds/server/
sshpass -p ${{ secrets.VPS_PASSWORD }} rsync -avz -e 'ssh -o StrictHostKeyChecking=no' scripts/ vishalds@${{ secrets.VPS_HOST }}:/home/vishalds/scripts/
env:
VPS_PASSWORD: ${{ secrets.VPS_PASSWORD }}
- name: restart server
run: |
sshpass -p ${{ secrets.VPS_PASSWORD }} ssh -o StrictHostKeyChecking=no vishalds@${{ secrets.VPS_HOST }} 'echo ${{ secrets.VPS_PASSWORD }} | sudo -S systemctl restart zitefy.service'
env:
VPS_PASSWORD: ${{ secrets.VPS_PASSWORD }}