diff --git a/.github/workflows/deploy-develop.yml b/.github/workflows/deploy-develop.yml deleted file mode 100644 index 5549af8..0000000 --- a/.github/workflows/deploy-develop.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Deploy to Staging - -on: - push: - branches: - - develop - -jobs: - deploy: - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v3 - - - name: Install Dependencies - run: | - npm ci - npm run build - - - name: Deploy to Amplify (Staging) - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - run: | - npx amplify-cli publish --yes --branch develop diff --git a/.github/workflows/deploy-main.yml b/.github/workflows/deploy-main.yml deleted file mode 100644 index a8453cd..0000000 --- a/.github/workflows/deploy-main.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Deploy to Production - -on: - push: - branches: - - main - -jobs: - deploy: - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v3 - - - name: Install Dependencies - run: | - npm ci - npm run build - - - name: Deploy to Amplify (Production) - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - run: | - npx amplify-cli publish --yes --branch main diff --git a/.tmp/delete-preview.text b/.tmp/delete-preview.text new file mode 100644 index 0000000..5586146 --- /dev/null +++ b/.tmp/delete-preview.text @@ -0,0 +1,25 @@ +name: Delete Preview on PR Close + +on: + pull_request: + types: + - closed # PR이 병합되거나 닫혔을 때 실행 + +jobs: + delete-preview: + runs-on: ubuntu-latest + + steps: + # 1. AWS CLI 설정 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ap-northeast-2 # 원하는 AWS 리전 + + # 2. S3에서 PR 관련 파일 삭제 + - name: Delete Preview Files from S3 + run: | + PR_NUMBER=${{ github.event.pull_request.number }} + aws s3 rm s3://your-preview-bucket/pr-${PR_NUMBER} --recursive diff --git a/.tmp/preview-deploy.text b/.tmp/preview-deploy.text new file mode 100644 index 0000000..c4530c4 --- /dev/null +++ b/.tmp/preview-deploy.text @@ -0,0 +1,49 @@ +name: Deploy Preview for PRs + +on: + pull_request: + branches: + - main + - develop + +jobs: + deploy-preview: + runs-on: ubuntu-latest + + steps: + # 1. 코드 체크아웃 + - name: Checkout code + uses: actions/checkout@v2 + + # 2. AWS 인증 정보 설정 + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ap-northeast-2 + + # 3. 의존성 설치 + - name: Install dependencies + run: yarn install + + # 4. 빌드 실행 + - name: Build application + run: yarn build + + # 5. S3에 미리보기 배포 + - name: Deploy to S3 + run: | + aws s3 sync ./dist s3://your-preview-bucket/pr-${{ github.event.number }} --acl public-read --delete + + - name: Checkout code + uses: actions/checkout@v2 + + # 2. PR에 코멘트 추가 + - name: Add comment to PR + run: | + PREVIEW_URL="https://davinci-preview-bucket.s3.ap-northeast-2.amazonaws.com/pr-${{ github.event.number }}/" + curl -H "Authorization: token ${{ secrets.MY_PAT }}" \ + -H "Content-Type: application/json" \ + -d "{\"body\": \"Preview available at: $PREVIEW_URL\"}" \ + "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" diff --git a/tmpdeploy.text b/.tmp/tmpdeploy.text similarity index 100% rename from tmpdeploy.text rename to .tmp/tmpdeploy.text diff --git a/src/App.tsx b/src/App.tsx index e9f490b..dbac9a1 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -9,7 +9,6 @@ function App() {
-