Skip to content

Deploy Next.js ReUI #40

Deploy Next.js ReUI

Deploy Next.js ReUI #40

Workflow file for this run

name: Deploy Next.js ReUI
on:
push:
branches: [nonexistent-branch]
workflow_dispatch:
env:
NODE_VERSION: 20.x
DEPLOY_PORT: 3004
APP_NAME: reui-web
APP_URL: https://reui.io
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy to server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_PROD_HOST }}
username: ${{ secrets.SSH_PROD_USER }}
password: ${{ secrets.SSH_PROD_PSW }}
port: ${{ secrets.SERVER_PORT || 22 }}
script: |
cd /var/www/reui/reui
# Pull latest changes
rm package-lock.json
git reset --hard && git pull
# Install dependencies
npm i -f
# Debug: Show contents of existing .env.production file
echo "=== Current .env.production Contents ==="
if [ -f .env.production ]; then
cat .env.production
else
echo ".env.production file does not exist"
fi
echo "========================================"
# Build application on server
npm run build
# Restart application
export PORT=${{ env.DEPLOY_PORT }}
pm2 restart "${{ env.APP_NAME }}" --update-env || pm2 start npm --name "${{ env.APP_NAME }}" -- start
- name: Deployment status
run: |
echo "✅ Deployment completed successfully"
echo "🌐 Environment is available at: ${{ env.APP_URL }}"