Skip to content

Deploy to Beta Site #10

Deploy to Beta Site

Deploy to Beta Site #10

Workflow file for this run

name: Deploy to Beta Site
on:
pull_request:
branches: ["master"]
types: ["opened"]
paths:
- frontend/**
workflow_dispatch:
jobs:
deploy-frontend:
runs-on: ubuntu-latest
steps:
- name: Deploy to Digital Ocean droplet via SSH action
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
command_timeout: 60m
script: |
ls
cd /home/treeckle/Treeckle-3.0
# Temp store changes
git stash
# Pull from git repo
git checkout ${{ github.event.pull_request.head.sha || 'master' }} || true # Force return true so exit code is not 1
git pull
# Clear space
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S docker image prune -f
# Build
cd frontend
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S bash ./build.sh
cd ..
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S docker-compose -f ./docker-compose.prod.yml up -d frontend
# Restore changes
git stash pop || true # Force return true in case no changes stashed