Skip to content

Commit

Permalink
[FEATURE] Github Action 을 통한 CI/CD 구축 (#28)
Browse files Browse the repository at this point in the history
* chore: github action 스크립트 작성 (#27)

* chore: s3 에서 ec2 배포 스크립트 (#27)

* fix: node 버전 수정 (#27)

* fix: Github Action 빌드 오류 (#27)

* chore: 백엔드 서버 ip 변경 (#27)

* chore: s3, codedeploy 명 변경 (#27)

* chore: appspec 수정 (#27)

* delete: nginx 재시작 스크립트 (#27)

* test: github action 테스트 (#27)

* test: github action 테스트 완료 (#27)
  • Loading branch information
hyunmin0317 authored Nov 8, 2024
1 parent 79c115b commit 4455a38
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 1 deletion.
52 changes: 52 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release CI/CD

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
fetch-tags: true

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20.11.1'

- name: Install Dependencies
run: npm ci

- name: Build
run: unset CI && npm run build

- name: Create Deployment Package
run: zip -qq -r ./build.zip .
shell: bash

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Upload to S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: aws s3 cp --region ap-northeast-2 ./build.zip s3://smunity/build.zip

- name: Deploy
run: aws deploy create-deployment
--application-name smunity
--deployment-config-name CodeDeployDefault.AllAtOnce
--deployment-group-name smunity-web
--s3-location bucket=smunity,key=build.zip,bundleType=zip
18 changes: 18 additions & 0 deletions appspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 0.0
os: linux

files:
- source: /
destination: /home/ubuntu/smunity-web
overwrite: yes

permissions:
- object: /home/ubuntu/smunity-web
owner: ubuntu
group: ubuntu
mode: 755
# hooks:
# AfterInstall:
# - location: 'service nginx restart'
# timeout: 60
# runas: root
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@
"last 1 safari version"
]
},
"proxy": "http://54.180.207.222"
"proxy": "http://15.165.215.184"
}

0 comments on commit 4455a38

Please sign in to comment.