Skip to content

Commit

Permalink
Add a server workflow
Browse files Browse the repository at this point in the history
On a release create event, build and push to RoyalGuard's main server.

Signed-off-by: kingbri <bdashore3@gmail.com>
  • Loading branch information
bdashore3 committed Sep 10, 2020
1 parent 2700091 commit 267de57
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Push and Restart bot

on:
release:
types:
- created

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Cache Deps
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cargo build --release --verbose
- name: Run tests
run: cargo test --verbose
- name: Remove old binary
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script: rm -rf ~/RoyalGuard/royalguard
- name: Push new binary
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
source: target/release/royalguard
target: ~/RoyalGuard
strip_components: 2
- name: Restart CourtJester
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script: sudo systemctl restart royalguard.service

0 comments on commit 267de57

Please sign in to comment.