Picture of the author
ROXIE.
DEV
(CI/CD)Github 작업을 사용하여 AWS S3에 React 배포하기(2)Github Action 설정
(CI/CD)Github 작업을 사용하여 AWS S3에 React 배포하기(2)

GitHub Secrets 설정

  1. repository > Settings > Secrets and variables > Actions > New repository secret

💡 process.env.AWS_ACCESS_KEY_ID와 같이 저장되기 때문에 후에 AWS CLI에서 편하게 명령어를 입력을 위해 AWS_ACCESS_KEY_ID와 AWS_SECRET_ACCESS_KEY의 이름은 반드시 맞춰서 생성한다.

YML
1// workflow 사용 예 2 - name: Deploy # Upload build file to S3 3 env: 4 AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} 5 AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

GitHub Action Workflow 생성

  1. repository > Actions > set up a workflow yourself or Simple workflow

YML
1name: deploy # Workflow 이름 2on: # Event 감지 3 push: 4 branches: 5 - master 6jobs: # Job 설정 7 build: 8 runs-on: ubuntu-latest 9 steps: 10 - name: Checkout source code. # Repo checkout 11 uses: actions/checkout@v3 12 13 - name: Check Node v # Node v 확인 14 run: node -v 15 16 - name: Install dependencies # 의존 파일 설치 17 run: npm install 18 19 - name: Generate build # React Build 20 run: npm run build 21 22 - name: Deploy # Upload build file to S3 23 env: 24 AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} 25 AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 26 run: | 27 aws s3 cp --recursive --region ap-northeast-2 build s3://S3버킷 명

CI/CD 확인

  1. push 명령어를 사용하면 자동으로 배포된 것을 확인 할 수 있다.

End Point URL으로 확인

참고: https://synuns.tistory.com/75 https://mingmeng030.tistory.com/279 https://puterism.com/deploy-with-s3-and-cloudfront/

(CI/CD)Github 작업을 사용하여 AWS S3에 React 배포하기(1)
(CI/CD)Github 작업을 사용하여 AWS S3에 React 배포하기(1)AWS S3 버킷 생성
chat GPT 연동하기
chat GPT 연동하기OpenAI API key발급 받아서 chat GPT 연동
생성일: 2024.02.13수정일: 2024.02.13
목차