Skip to content

Commit

Permalink
Added deployment workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalkrishnads committed Feb 12, 2024
1 parent 570a12a commit 44c47fd
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: Rust
name: Deploy to VPS

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always
Expand All @@ -16,7 +14,17 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Build project
run: cargo build --release --verbose
- name: Install sshpass
run: sudo apt-get install sshpass
- name: Copy release directory to server
run: |
sshpass -p ${{ secrets.VPS_PASSWORD }} scp -o StrictHostKeyChecking=no -r target/release root@${{ secrets.VPS_HOST }}:/home/alpadrive/server/
env:
VPS_PASSWORD: ${{ secrets.VPS_PASSWORD }}
- name: Restart systemd process on server
run: |
sshpass -p ${{ secrets.VPS_PASSWORD }} ssh -o StrictHostKeyChecking=no root@${{ secrets.VPS_HOST }} 'sudo systemctl restart server.service'
env:
VPS_PASSWORD: ${{ secrets.VPS_PASSWORD }}

0 comments on commit 44c47fd

Please sign in to comment.