Skip to content

Deploy to DigitalOcean by @nseymoursmith #12

Deploy to DigitalOcean by @nseymoursmith

Deploy to DigitalOcean by @nseymoursmith #12

Workflow file for this run

name: deploy to digitalOcean
run-name: Deploy to DigitalOcean by @${{ github.actor }}
on:
push:
branches:
- main
- fix-ci
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy rust app
uses: appleboy/ssh-action@v0.1.2
with:
host: ${{secrets.SSH_HOST}} # IP address of the server you wish to ssh into
key: ${{secrets.SSH_KEY}} # Private or public key of the server
username: ${{ secrets.SSH_USERNAME }} # User of the server you want to ssh into
script: |
if ! [ -d "$HOME/waterlogged-prototype/" ]; then
echo 'repo does not exist!'
exit 1
fi
cd $HOME/waterlogged-prototype/
git pull
if [ $? != 0 ]; then
echo "git pull failed, check the server logs!"
exit 1
fi
#./deploy-rust.sh
if ! [ -d "$HOME/waterlogged-prototype/dockerised-rust-api/" ]; then
echo 'docker app directory does not exist!'
exit 1
fi
./target/release/api-example &
if [ $? != 0 ]; then
echo "deploy-rust.sh failed, check the server logs!"
exit 1
fi
echo 'Deployment successful to digital ocean'
exit 0