feat: replace Fly.io deployment with EC2 SSH deployment #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to EC2 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy to EC2 | |
| uses: appleboy/ssh-action@v1.0.3 | |
| with: | |
| host: ${{ secrets.EC2_HOST }} | |
| username: ${{ secrets.EC2_USER }} | |
| key: ${{ secrets.EC2_SSH_KEY }} | |
| script_stop: true | |
| script: | | |
| # Set up environment | |
| cd /var/www/Scholarships-Plus | |
| # Pull latest changes | |
| echo "Pulling latest changes..." | |
| git fetch origin | |
| git reset --hard origin/main | |
| # Install dependencies | |
| echo "Installing dependencies..." | |
| npm install --ci | |
| # Generate Prisma Client | |
| echo "Generating Prisma Client..." | |
| npx prisma generate | |
| # Run database migrations | |
| echo "Running database migrations..." | |
| npx prisma migrate deploy | |
| # Build Remix app and server | |
| echo "Building Remix app..." | |
| npm run build | |
| # Package Chrome extension for download | |
| echo "Packaging Chrome extension..." | |
| npm run build:extension | |
| # Restart PM2 process | |
| echo "Restarting PM2 process..." | |
| pm2 restart scholarships-plus | |
| # Show status | |
| echo "Deployment complete. Status:" | |
| pm2 list | grep scholarships-plus |