Skip to content

πŸ“¦οΈ Chore: S3-CloudFront CICD Settings μˆ˜μ • #27

πŸ“¦οΈ Chore: S3-CloudFront CICD Settings μˆ˜μ •

πŸ“¦οΈ Chore: S3-CloudFront CICD Settings μˆ˜μ • #27

Workflow file for this run

name: Deploy to S3 and CloudFront
on:
push:
branches: [dev] # dev λΈŒλžœμΉ˜μ— ν‘Έμ‹œλ  λ•Œ μ›Œν¬ν”Œλ‘œμš° μ‹€ν–‰
env:
CI: false # CI ν™˜κ²½ λ³€μˆ˜ μ„€μ •
jobs:
build:
runs-on: ubuntu-latest # μ΅œμ‹  μš°λΆ„νˆ¬ ν™˜κ²½μ—μ„œ μ‹€ν–‰
steps:
- name: Checkout source code
uses: actions/checkout@v2 # μ›Œν¬ν”Œλ‘œμš°μ—μ„œ μ•‘μ„ΈμŠ€ν•  수 μžˆλ„λ‘ μ €μž₯μ†Œλ₯Ό 체크아웃
- name: Install dependencies
run: yarn install # ν”„λ‘œμ νŠΈμ˜ μ˜μ‘΄μ„± μ„€μΉ˜
- name: Build
run: yarn build # ν”„λ‘œμ νŠΈ λΉŒλ“œ
- 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 리전
- 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 # 였λ₯˜ λ°œμƒ μ‹œμ—λ„ 계속 진행