Add demo video link and update README content #35
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: Checkout code | |
| uses: actions/checkout@v2 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v2 | |
| with: | |
| node-version: '20' | |
| - name: Deploy to EC2 | |
| run: | | |
| echo "${{ secrets.EC2_SSH_KEY }}" > PennyWise.pem | |
| chmod 600 PennyWise.pem | |
| ssh -i "PennyWise.pem" -o StrictHostKeyChecking=no ubuntu@${{ secrets.EC2_IP_ADDRESS }} << 'EOF' | |
| # Update the package index | |
| sudo apt update | |
| # Install Node.js and npm if not installed | |
| if ! command -v node &> /dev/null; then | |
| sudo apt install -y nodejs npm | |
| fi | |
| # Install PM2 if not installed | |
| if ! command -v pm2 &> /dev/null; then | |
| sudo npm install -g pm2 # Make sure to use sudo here for global install | |
| fi | |
| # Change to the project directory | |
| cd ~/FinanceTracker | |
| # Pull the latest changes | |
| git pull | |
| # Change to the BackEnd directory | |
| cd BackEnd | |
| # Install dependencies | |
| npm install | |
| # Restart the PM2 process | |
| pm2 restart all | |
| sudo systemctl restart nginx | |
| EOF |