Skip to content

fix(github): fixed deploy file #9

fix(github): fixed deploy file

fix(github): fixed deploy file #9

Workflow file for this run

name: Deploy Voodle Frontend to DigitalOcean
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SERVER_SSH_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}
- name: Deploy Frontend to DigitalOcean
env:
HOST: ${{ secrets.HOST }}
USER: ${{ secrets.USER }}
FRONTEND_ENV: ${{ secrets.FRONTEND_ENV }}
run: |
ssh $USER@$HOST << EOF
set -e
echo "Starting frontend deployment..."
# Source profile and set up PATH
source ~/.profile
export PATH="/home/$USER/.local/share/pnpm:$PATH"
# Navigate to project directory and update changes
cd /var/www/voodle/client
git fetch origin main
git reset --hard origin/main
# Set up environment
echo "$FRONTEND_ENV" > .env
# Install dependencies and build
pnpm install
pnpm run build
# Restart the frontend service
pm2 restart voodle-frontend || pm2 start "pnpm start" --name "voodle-frontend"
pm2 save
echo "Frontend deployment completed successfully"
EOF