chore: 목차 추가 #10
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: aws s3 + cloudfront CI/CD | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
Deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Node 설치 | |
uses: actions/setup-node@v4 | |
- name: Github Repository 파일 불러오기 | |
uses: actions/checkout@v4 | |
- name: nvm을 활용한 프로젝트의 Node 설치 | |
uses: irby/setup-node-nvm@master | |
- name: yarn 설치 | |
run: | | |
npm install -g yarn | |
yarn --version | |
- name: 패키지 설치 | |
run: | | |
yarn install | |
- name: .env 파일 만들기 | |
run: | | |
echo 'NEXT_PUBLIC_GOOGLE_ANALYTICS=${{ secrets.NEXT_PUBLIC_GOOGLE_ANALYTICS }}' > .env | |
echo 'NEXT_PUBLIC_API_KEY=${{ secrets.NEXT_PUBLIC_GIT_TOKEN }}' >> .env | |
- name: 빌드 | |
run: | | |
yarn build | |
- name: AWS credentials 설정(aws resource접근) | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: ap-northeast-2 | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: S3 기존 파일들 전체 삭제 후 새로 업로드 | |
run: | | |
aws s3 rm --recursive s3://next-blog-project | |
aws s3 cp ./out s3://next-blog-project/ --recursive | |
- name: Cloudfornt 캐시 무효화 | |
run: aws cloudfront create-invalidation --distribution-id E12Q5DCOCOBVQC --paths "/*" |