Merge pull request #24 from sopt-makers/chore/#23 #11
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: sentry-notifier-lambda-cd | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'corretto' | |
| - name: Setup Gradle with caching | |
| uses: gradle/actions/setup-gradle@v3 | |
| - name: Create .env file | |
| run: | | |
| mkdir -p src/main/resources | |
| printf '%s' "$DOTENV_FILE" > src/main/resources/.env | |
| env: | |
| DOTENV_FILE: ${{ secrets.DOTENV_FILE }} | |
| - name: Build shadow JAR (default = shadowJar) | |
| run: ./gradlew build | |
| - 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: ap-northeast-2 | |
| - name: Deploy to AWS Lambda | |
| run: | | |
| export AWS_PAGER="" | |
| aws lambda update-function-code \ | |
| --function-name sentry-notifier \ | |
| --zip-file fileb://build/libs/sentry-webhook-shadow.jar | |
| - name: Notify Slack on success | |
| uses: 8398a7/action-slack@v3 | |
| if: success() | |
| with: | |
| status: custom | |
| custom_payload: | | |
| { | |
| "attachments": [{ | |
| "color": "good", | |
| "title": "✅ Lambda 배포 성공", | |
| "text": "Sentry Notifier Lambda가 성공적으로 배포되었습니다.\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|워크플로우 링크>" | |
| }] | |
| } | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CD_WEBHOOK_URL }} | |
| - name: Notify Slack on failure | |
| uses: 8398a7/action-slack@v3 | |
| if: failure() | |
| with: | |
| status: custom | |
| custom_payload: | | |
| { | |
| "attachments": [{ | |
| "color": "danger", | |
| "title": "❌ Lambda 배포 실패", | |
| "text": "Sentry Notifier Lambda 배포에 실패했습니다.\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|워크플로우 링크>" | |
| }] | |
| } | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CD_WEBHOOK_URL }} |