-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from delicious-algorithme/dev
ci-cd 구축, dev merge to main
- Loading branch information
Showing
4 changed files
with
18,865 additions
and
18,805 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: 0.0 | ||
os: linux | ||
files: | ||
- source: / | ||
destination: /home | ||
hooks: | ||
AfterInstall: | ||
- location: scripts/restart_nginx.sh | ||
timeout: 60 | ||
runas: root |
Oops, something went wrong.