update readme #5
This file contains 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] | |
paths: | |
- "backend/**" # Only trigger on backend changes | |
- ".github/workflows/**" | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
# Add concurrency to prevent multiple deployments running at once | |
concurrency: | |
group: production | |
cancel-in-progress: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Deploy to EC2 | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.EC2_HOST }} | |
username: ubuntu | |
key: ${{ secrets.EC2_SSH_KEY }} | |
script: | | |
cd ~/gitpodcast | |
git fetch origin main | |
git reset --hard origin/main # Force local to match remote main | |
sudo chmod +x ./backend/nginx/setup_nginx.sh | |
sudo ./backend/nginx/setup_nginx.sh | |
chmod +x ./backend/deploy.sh | |
./backend/deploy.sh |