diff --git a/.github/actions/slack-notify/action.yml b/.github/actions/slack-notify/action.yml new file mode 100644 index 0000000..97a7974 --- /dev/null +++ b/.github/actions/slack-notify/action.yml @@ -0,0 +1,43 @@ +name: 'Slack Notification' +description: 'Send notification to Slack' +inputs: + status: + required: true + webhook-url: + required: true +runs: + using: "composite" + steps: + - shell: bash + run: | + if [ "${{ inputs.status }}" = "success" ]; then + message="*Success:* ✅ Backend CI Success ✅" + title="Success" + image_url="https://thumbs.dreamstime.com/b/success-red-stamp-text-white-44312500.jpg" + else + message="*Failure:* ❗️ Backend CI Failed ❗️" + title="Failure" + image_url="https://w7.pngwing.com/pngs/68/227/png-transparent-rubber-stamp-blue-world-dive-more-gmbh-architectural-engineering-office-praxis-fur-energetische-heilkunste-und-kinesiologie-others-text-rectangle-signage-thumbnail.png" + fi + + curl -X POST -H 'Content-type: application/json' \ + --data "{ + \"blocks\": [ + { + \"type\": \"section\", + \"text\": { + \"type\": \"mrkdwn\", + \"text\": \"$message\n*Repository:* ${{ github.repository }}\n*Ref:* ${{ github.ref }}\n*Event:* ${{ github.event_name }}\n*Commit:* ${{ github.sha }}\n*Triggered by:* ${{ github.actor }}\n*Workflow:* ${{ github.workflow }}\" + } + }, + { + \"type\": \"image\", + \"title\": { + \"type\": \"plain_text\", + \"text\": \"$title\" + }, + \"image_url\": \"$image_url\", + \"alt_text\": \"$title\" + } + ] + }" ${{ inputs.webhook-url }} \ No newline at end of file diff --git a/.github/workflows/gradle.yml b/.github/workflows/ci.yml similarity index 51% rename from .github/workflows/gradle.yml rename to .github/workflows/ci.yml index 261408e..1c48ad0 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/ci.yml @@ -1,3 +1,4 @@ +# .github/workflows/ci.yml name: Java CI with Gradle on: @@ -26,6 +27,7 @@ jobs: with: cache-read-only: ${{ github.ref != 'refs/heads/develop' }} + - name: Build with Gradle Wrapper run: ./gradlew build env: @@ -35,17 +37,18 @@ jobs: SPRING_DATASOURCE_USERNAME: sa SPRING_DATASOURCE_PASSWORD: password - SPRING_JPA_PROPERTIES_HIBERNATE_FORMAT_SQL: true - SPRING_JPA_PROPERTIES_HIBERNATE_SHOW_SQL: true + SPRING_JPA_PROPERTIES_HIBERNATE_FORMAT_SQL: false + SPRING_JPA_PROPERTIES_HIBERNATE_SHOW_SQL: false SPRING_JPA_OPEN_IN_VIEW: false # OAuth2 Client Information (use GitHub Secrets) SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_KAKAO_CLIENT_ID: ${{ secrets.KAKAO_CLIENT_ID }} SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_KAKAO_CLIENT_SECRET: ${{ secrets.KAKAO_CLIENT_SECRET }} - SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_KAKAO_REDIRECT_URI: http://localhost:8080/login/oauth2/code/kakao + SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_KAKAO_REDIRECT_URI: ${{ secrets.KAKAO_REDIRECT_URI }} SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_KAKAO_AUTHORIZATION_GRANT_TYPE: authorization_code SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_KAKAO_SCOPE: profile_nickname, profile_image SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_KAKAO_CLIENT_NAME: Kakao + SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_KAKAO_AUTHORIZATION_URI: https://kauth.kakao.com/oauth/authorize SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_KAKAO_TOKEN_URI: https://kauth.kakao.com/oauth/token SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_KAKAO_USER_INFO_URI: https://kapi.kakao.com/v2/user/me @@ -53,7 +56,7 @@ jobs: SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }} SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }} - SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_GOOGLE_REDIRECT_URI: http://localhost:8080/login/oauth2/code/google + SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_GOOGLE_REDIRECT_URI: ${{ secrets.GOOGLE_REDIRECT_URI }} SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_GOOGLE_AUTHORIZATION_GRANT_TYPE: authorization_code SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_GOOGLE_SCOPE: https://www.googleapis.com/auth/userinfo.profile, https://www.googleapis.com/auth/userinfo.email SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_GOOGLE_CLIENT_NAME: Google @@ -68,62 +71,11 @@ jobs: LOGGING_LEVEL_ROOT: info LOGGING_LEVEL_COM_MYCOM: debug - - name: Backend CI Slack Notification (Success) - if: success() - uses: 8398a7/action-slack@v3 + - name: Notify CI Slack + if: always() + uses: ./.github/actions/slack-notify with: - status: custom - fields: workflow,job,commit,repo,ref,author,took - custom_payload: | - { - "blocks": [ - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*Success:* ✅ Backend CI Success ✅\n\n*Repository:* ${{ github.repository }}\n*Ref:* ${{ github.ref }}\n\n*Event:* ${{ github.event_name }}\n*Commit:* ${{ github.sha }}\n*Triggered by:* ${{ github.actor }}\n*Workflow:* ${{ github.workflow }}" - } - }, - { - "type": "image", - "title": { - "type": "plain_text", - "text": "Success" - }, - "image_url": "https://thumbs.dreamstime.com/b/success-red-stamp-text-white-44312500.jpg", - "alt_text": "Success" - } - ] - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + status: ${{ job.status }} + webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} + - - name: Backend CI Slack Notification (Failure) - if: failure() - uses: 8398a7/action-slack@v3 - with: - status: custom - fields: workflow,job,commit,repo,ref,author,took - custom_payload: | - { - "blocks": [ - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*Failure:* ❗️ Backend CI Failed ❗️\n\n*Repository:* ${{ github.repository }}\n*Ref:* ${{ github.ref }}\n\n*Event:* ${{ github.event_name }}\n*Commit:* ${{ github.sha }}\n*Triggered by:* ${{ github.actor }}\n*Workflow:* ${{ github.workflow }}" - } - }, - { - "type": "image", - "title": { - "type": "plain_text", - "text": "Failure" - }, - "image_url": "https://w7.pngwing.com/pngs/68/227/png-transparent-rubber-stamp-blue-world-dive-more-gmbh-architectural-engineering-office-praxis-fur-energetische-heilkunste-und-kinesiologie-others-text-rectangle-signage-thumbnail.png", - "alt_text": "Failure" - } - ] - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}