frontend work !
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 1m38s
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 1m38s
This commit is contained in:
@@ -137,13 +137,30 @@ jobs:
|
||||
# This maps the Gitea secret to the environment variable the application expects.
|
||||
run: VITE_API_KEY=${{ secrets.VITE_GOOGLE_GENAI_API_KEY }} npm run build
|
||||
|
||||
- name: Deploy Frontend via Local Copy
|
||||
- name: Deploy Application to Server
|
||||
run: |
|
||||
echo "Deploying frontend files to local web server path..."
|
||||
# Ensure the destination directory exists before copying.
|
||||
mkdir -p "/var/www/flyer-crawler.projectium.com"
|
||||
# Use rsync to efficiently copy files from the 'dist' output to the web server directory.
|
||||
# The '--delete' flag removes old files from the destination, ensuring a clean deployment.
|
||||
# We exclude '.env.local' to prevent deleting the server-specific environment file.
|
||||
echo "Deploying application files to /var/www/flyer-crawler.projectium.com..."
|
||||
APP_PATH="/var/www/flyer-crawler.projectium.com"
|
||||
|
||||
# Ensure the destination directory exists
|
||||
mkdir -p "$APP_PATH"
|
||||
|
||||
# 1. Copy the backend source code and project files first.
|
||||
# We exclude node_modules, .git, and the build output (dist).
|
||||
rsync -avz --delete --exclude 'node_modules' --exclude '.git' --exclude 'dist' ./ "$APP_PATH/"
|
||||
|
||||
# 2. Copy the built frontend assets into the same directory.
|
||||
# This will correctly place index.html and the assets/ folder in the webroot.
|
||||
rsync -avz --delete --exclude '.env.local' dist/ "/var/www/flyer-crawler.projectium.com"
|
||||
echo "Local deployment complete."
|
||||
echo "Application deployment complete."
|
||||
|
||||
- name: Install Backend Dependencies and Restart Server
|
||||
run: |
|
||||
echo "Installing production dependencies and restarting server..."
|
||||
cd /var/www/flyer-crawler.projectium.com
|
||||
npm install --omit=dev # Install only production dependencies
|
||||
# Use pm2 to reload the application with zero downtime.
|
||||
# This assumes you have a pm2 process named 'flyer-crawler-api' configured on your server.
|
||||
# If not, you would use `pm2 start npm --name "flyer-crawler-api" -- run start` for the first time.
|
||||
pm2 reload flyer-crawler-api
|
||||
echo "Backend server reloaded successfully."
|
||||
Reference in New Issue
Block a user