为什么“ npm install”和“ pm2重新启动”不执行?

问题描述 投票:0回答:0

您正在这样做:

name: Deploy to DigitalOcean

on:
 push:
    branches:
      - main

jobs:
  deploy:
  runs-on: ubuntu-latest

steps:
  # Step 1: Check out the code from the repository
  - name: Checkout code
    uses: actions/checkout@v3

  # Step 2: Set up SSH agent using your private key stored in GitHub Secrets
  - name: Set up SSH agent
    uses: webfactory/[email protected]
    with:
      ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

  # Step 3: Deploy to DigitalOcean and create a .env file
  - name: Deploy to DigitalOcean
    run: |
      ssh -o StrictHostKeyChecking=no [email protected] << 'EOF'
        # Navigate to the application directory
        cd /root/circlo-app
        
        # Pull the latest code from the main branch
        git pull origin main
        
        # Create a .env file
        cat <<EOT > .env
        ...env vars
        EOT
        
        npm ci --production
        npm ci -g pm2
        echo "Restarting application..."
        pm2 restart all
        pm2 list
        echo "Application restarted."
      EOF
      echo "Deployment complete."
。这将重新安装PM2,因此,如果重新安装,您会放松工作。

,什么都不会重新开始。您必须创建PM2任务而不是重新启动。
	
continuous-integration pm2
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.