Merge pull request #16 from Saga690/frontend-new #8
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: [new] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install SSH Key | |
| uses: webfactory/[email protected] | |
| with: | |
| ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| - name: Deploy React App | |
| run: | | |
| # Store key securely | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/deploy_key | |
| chmod 600 ~/.ssh/deploy_key | |
| # Connect with verbose logging | |
| ssh -vvv -o StrictHostKeyChecking=no \ | |
| -o UserKnownHostsFile=/dev/null \ | |
| -i ~/.ssh/deploy_key \ | |
| ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} " | |
| cd /var/www/website/marsiitr.github.io | |
| git fetch origin new | |
| git checkout new | |
| npm install | |
| npm run build | |
| sudo systemctl restart nginx | |
| " |