Create deploy.yml for deploying via Github actions

This commit is contained in:
Tyler Hallada 2023-10-19 22:53:09 -04:00 committed by GitHub
parent 8feb2ec10e
commit 1305cf490a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

31
.github/workflows/deploy.yml vendored Normal file
View File

@ -0,0 +1,31 @@
name: Deploy
on:
push:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup toolchain install stable --profile minimal
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --release --verbose
- name: Run tests
run: cargo test --verbose
- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: 'just-a-placeholder-so-we-dont-get-errors'
- name: Adding Known Hosts
run: ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
- name: Deploy with rsync
run: rsync -avz ./target/ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/home/crawlnicle/crawlnicle/target/