Update deploy.yml #3
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@v3 | |
| - name: Create SSH key from secret | |
| run: | | |
| echo "${{ secrets.EC2_SSH_KEY }}" | base64 -d > ec2_key.pem | |
| chmod 400 ec2_key.pem | |
| - name: Deploy to EC2 via SSH | |
| uses: appleboy/ssh-action@v1.0.0 | |
| with: | |
| host: ${{ secrets.EC2_HOST }} | |
| username: ${{ secrets.EC2_USERNAME }} | |
| key_path: ec2_key.pem | |
| script: | | |
| cd /home/ubuntu/skribble-app | |
| git pull origin main | |
| docker-compose down | |
| docker-compose up -d --build |