Skip to content

Commit

Permalink
πŸ“¦οΈ Chore: S3-CloudFront CICD Settings μˆ˜μ •
Browse files Browse the repository at this point in the history
  • Loading branch information
jinyeongjang authored Oct 12, 2024
1 parent a1cf8e3 commit 1401389
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,30 @@ jobs:

steps:
- name: Checkout source code
uses: actions/checkout@v2 # μ›Œν¬ν”Œλ‘œμš°μ—μ„œ μ•‘μ„ΈμŠ€ν•  수 μžˆλ„λ‘ μ €μž₯μ†Œλ₯Ό 체크아웃
uses: actions/checkout@v3 # μ›Œν¬ν”Œλ‘œμš°μ—μ„œ μ•‘μ„ΈμŠ€ν•  수 μžˆλ„λ‘ μ €μž₯μ†Œλ₯Ό 체크아웃

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Install dependencies
run: yarn install # ν”„λ‘œμ νŠΈμ˜ μ˜μ‘΄μ„± μ„€μΉ˜

- name: Build
run: yarn build # ν”„λ‘œμ νŠΈ λΉŒλ“œ

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} # AWS μ•‘μ„ΈμŠ€ ν‚€ ID
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} # AWS μ‹œν¬λ¦Ώ μ•‘μ„ΈμŠ€ ν‚€
aws-region: ${{ secrets.AWS_REGION }} # AWS 리전

- name: S3 Deploy
run: aws s3 sync ./dist s3://bobpience-s3-bucket/ --acl bucket-owner-full-control # ν˜„μž¬ λΉŒλ“œλœ 폴더에 μ ‘κ·Ό ν›„ S3 버킷에 λΉŒλ“œ 파일 μ—…λ‘œλ“œ
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} # AWS μ•‘μ„ΈμŠ€ ν‚€ ID
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} # AWS μ‹œν¬λ¦Ώ μ•‘μ„ΈμŠ€ ν‚€
AWS_REGION: ${{ secrets.AWS_REGION }} # AWS 리전
run: aws s3 sync ./dist s3://bobpience-s3-bucket/ --delete # ν˜„μž¬ λΉŒλ“œλœ 폴더에 μ ‘κ·Ό ν›„ S3 버킷에 λΉŒλ“œ 파일 μ—…λ‘œλ“œ, λΆˆν•„μš”ν•œ 파일 μ‚­μ œ

- name: Invalidate CloudFront Cache
uses: chetan/invalidate-cloudfront-action@master # CloudFront μΊμ‹œ λ¬΄νš¨ν™” - CloudFrontλŠ” 배포 μ‹œ μ μš©κΉŒμ§€ 24μ‹œκ°„μ΄ μ†Œμš”λœλ‹€. μ—…λ°μ΄νŠΈ λ‚΄μš©μ„ λ°˜μ˜ν•˜κΈ°μœ„ν•΄μ„œλŠ” λ°˜λ“œμ‹œ λ¬΄νš¨ν™” μ²˜λ¦¬κ°€ ν•„μš”ν•˜λ‹€
env:
AWS_DISTRIBUTION: ${{ secrets.AWS_DISTRIBUTION_ID }} # CloudFront 배포 ID
PATHS: '/*' # λ¬΄νš¨ν™”ν•  경둜
continue-on-error: true # 였λ₯˜ λ°œμƒ μ‹œμ—λ„ 계속 진행
run: |
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_DISTRIBUTION_ID }} --paths "/*"
# CloudFront μΊμ‹œ λ¬΄νš¨ν™” - CloudFrontλŠ” 배포 μ‹œ μ μš©κΉŒμ§€ 24μ‹œκ°„μ΄ μ†Œμš”λœλ‹€. μ—…λ°μ΄νŠΈ λ‚΄μš©μ„ λ°˜μ˜ν•˜κΈ°μœ„ν•΄μ„œλŠ” λ°˜λ“œμ‹œ λ¬΄νš¨ν™” μ²˜λ¦¬κ°€ ν•„μš”ν•˜λ‹€

0 comments on commit 1401389

Please sign in to comment.