Merge pull request #4 from Final-Project-Team-Temporary/develop #4
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 with Docker Compose | |
| on: | |
| push: | |
| branches: [ release ] # 또는 deploy 브랜치 등 | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v3 | |
| - name: Generate .env on EC2 | |
| uses: appleboy/ssh-action@v1.0.0 | |
| with: | |
| host: ${{ secrets.EC2_HOST }} | |
| username: ${{ secrets.EC2_USERNAME }} | |
| key: ${{ secrets.EC2_SSH_KEY }} | |
| script: | | |
| echo "${{ secrets.APPLICATION_PROPERTIES }}" | sudo tee /home/ubuntu/crawler/.env > /dev/null | |
| - name: Deploy to EC2 via SSH | |
| uses: appleboy/ssh-action@v1.0.0 | |
| with: | |
| host: ${{ secrets.EC2_HOST }} | |
| username: ubuntu | |
| key: ${{ secrets.EC2_SSH_KEY }} | |
| script: | | |
| sudo cd /home/ubuntu/crawler | |
| git pull origin main | |
| docker compose down | |
| docker compose pull | |
| docker compose up -d --build |