Skip to content

fix: github actions 명령어 수정 (SSM으로 직접 명령 날리게) #2

fix: github actions 명령어 수정 (SSM으로 직접 명령 날리게)

fix: github actions 명령어 수정 (SSM으로 직접 명령 날리게) #2

Workflow file for this run

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