fix: github actions 명령어 수정 (SSM으로 직접 명령 날리게) #2
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 via SSM | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install AWS CLI | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y awscli | |
| - name: Deploy via SSM | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| AWS_REGION: ${{ secrets.AWS_REGION }} | |
| EC2_INSTANCE_ID: ${{ secrets.EC2_INSTANCE_ID }} | |
| run: | | |
| aws ssm send-command \ | |
| --document-name "AWS-RunShellScript" \ | |
| --instance-ids "$EC2_INSTANCE_ID" \ | |
| --region "$AWS_REGION" \ | |
| --comment "Deploying via SSM" \ | |
| --parameters commands=["cd ~/your-folder && git pull && docker compose up -d"] \ | |
| --output text |