fix: post body 형식 수정 #43
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 React to EC2 using S3 and CodeDeploy | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ap-northeast-2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '21.1.0' # Node.js 21.1.0 버전 사용 | |
- name: Install dependencies | |
run: npm install | |
- name: Build React app | |
run: npm run build | |
- name: Zip build folder and appspec | |
run: zip -r react-app.zip build appspec.yml scripts/ | |
- name: Upload the ZIP file to S3 | |
run: aws s3 cp react-app.zip s3://matal-s3/ | |
- name: Deploy to CodeDeploy | |
run: | | |
aws deploy create-deployment \ | |
--application-name matal-codedeploy \ | |
--deployment-group-name matal-codedeploy \ | |
--deployment-config-name CodeDeployDefault.OneAtATime \ | |
--description "Deploying React app from GitHub Actions" \ | |
--file-exists-behavior OVERWRITE \ | |
--s3-location bucket=matal-s3,key=react-app.zip,bundleType=zip |