Merge pull request #130 from WithTime12/refactor/#129 #18
This file contains hidden or 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: cicd action | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v3 | |
| - name: Check Node.js version | |
| run: node -v | |
| - name: Install pnpm | |
| run: npm install -g pnpm | |
| - name: Create .env file | |
| run: | | |
| echo "VITE_API_BASE_URL=${{ secrets.VITE_API_BASE_URL }}" >> .env | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: ${{ secrets.AWS_REGION }} | |
| - name: Generate build | |
| run: pnpm run build | |
| - name: Deploy to S3 | |
| run: | | |
| aws s3 cp --recursive --region ap-northeast-2 dist s3://${{ secrets.AWS_BUCKET_NAME }} | |
| - name: Invalidate CloudFront Cache | |
| run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_DISTRIBUTION_ID }} --paths "/*" | |
| continue-on-error: true | |
| - name: Notify Discord | |
| if: success() | |
| run: | | |
| curl -H "Content-Type: application/json" \ | |
| -X POST \ | |
| -d "{\"content\": \"✅ 배포가 완료되었습니다! 🎉 (브랜치: main)\"}" \ | |
| ${{ secrets.DISCORD_WEBHOOK_URL }} |