Skip to content

Commit

Permalink
Merge pull request #224 from JECT-Study/fix/deploy
Browse files Browse the repository at this point in the history
Fix: 배포 workflow 수정
  • Loading branch information
CLOUDoort authored Nov 26, 2024
2 parents 5eb171a + 46c01c8 commit 13e0f4f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 23 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,30 @@ jobs:
- name: Install dependencies
run: npm ci

# 4. 빌드 실행
# 4. 기존 빌드 파일 삭제
- name: Clean build directory
run: |
rm -rf dist
# 5. 빌드 실행
- name: Build project
run: npm run build

# 5. AWS 크레덴셜 설정
# 6. AWS 크레덴셜 설정
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v3
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

# 6. S3로 배포
# 7. S3로 배포
- name: Deploy to S3
run: |
aws s3 sync ./dist s3://${{ secrets.S3_BUCKET_NAME }} --delete
aws s3 sync ./dist s3://${{ secrets.S3_BUCKET_NAME }} --delete --exact-timestamps
echo "Deployment to S3 and CloudFront completed successfully!"
# 7. CloudFront 캐시 무효화
# 8. CloudFront 캐시 무효화
- name: Invalidate CloudFront Cache
run: |
aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*"
Expand Down
21 changes: 20 additions & 1 deletion src/app/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,30 @@ import { store } from './store';

export const serverAPI = (path: string) => `${import.meta.env.VITE_API_URL}${path}`;

async function setupMocks(): Promise<void> {
if (import.meta.env.MODE !== 'development') {
return;
}

if (import.meta.env.VITE_USE_MOCK !== 'true') return;

const { worker } = await import('../shared/test/browser');
await worker.start({
onUnhandledRequest: (req) => {
const url = new URL(req.url);
if (url.pathname.endsWith('.svg')) {
return; // .svg 파일 요청을 무시
}
},
});
}


(async () => {
const token = localStorage.getItem('accessToken');
if (token) store.dispatch(storeLogin({ token }))

await import('../shared/test/setupMocks').then((module) => module.setupMocks())
await setupMocks()

ReactDOM.createRoot(document.getElementById('root')!).render(
<ReactQueryProvider>
Expand Down
17 changes: 0 additions & 17 deletions src/shared/test/setupMocks.ts

This file was deleted.

0 comments on commit 13e0f4f

Please sign in to comment.