diff --git a/.github/workflows/discord-pr.yaml b/.github/workflows/discord-pr.yaml new file mode 100644 index 0000000..4b40806 --- /dev/null +++ b/.github/workflows/discord-pr.yaml @@ -0,0 +1,25 @@ +name: Discord PR Notification + +on: + pull_request: + types: [opened, reopened] + +jobs: + notify_discord: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Discord Notification + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_PR_WEBHOOK }} + DISCORD_USERNAME: GitHub + DISCORD_AVATAR: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png + uses: Ilshidur/action-discord@master + with: + args: | + 새로운 PR이 열렸습니다!<@${{ secrets.DISCORD_ID_1 }}> <@${{ secrets.DISCORD_ID_2 }}> + PR: ${{ github.event.pull_request.html_url }} + 작성자: ${{ github.event.pull_request.user.login }} + 제목: ${{ github.event.pull_request.title }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2a04fcf..a8daddc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,12 +7,21 @@ jobs: build: runs-on: ubuntu-20.04 steps: - - name: Checkout source code. + - name: Checkout source code uses: actions/checkout@v3 - + with: + fetch-depth: 0 + + - name: Get commit message and author + id: get_commit_info + run: | + echo "::set-output name=message::$(git log --format=%s -n 1)" + echo "::set-output name=author::$(git log --format=%an -n 1)" + echo "::set-output name=author_username::$(git log --format=%ae -n 1 | cut -d@ -f1)" + - name: Install dependencies run: yarn install - + - name: Generate build env: VITE_API_BASE_URL: ${{ secrets.VITE_API_BASE_URL }} @@ -20,10 +29,45 @@ jobs: VITE_OAUTH_KAKAO_CLIENT_SECRET_CODE: ${{ secrets.VITE_OAUTH_KAKAO_CLIENT_SECRET_CODE }} VITE_OAUTH_KAKAO_REDIRECT_URI: ${{ secrets.VITE_OAUTH_KAKAO_REDIRECT_URI }} run: yarn build - - - name: Deploy + + - name: Deploy to S3 + id: deploy env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} run: | aws s3 sync --region ap-northeast-2 dist s3://alignlab-client --delete + continue-on-error: true + + - name: Discord notification - Success + if: steps.deploy.outcome == 'success' + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_DEPLOY_WEBHOOK }} + DISCORD_USERNAME: GitHub + DISCORD_AVATAR: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png + uses: Ilshidur/action-discord@master + with: + args: | + 🎉 배포가 성공적으로 완료되었습니다! + 브랜치: develop + 커밋: ${{ steps.get_commit_info.outputs.message }} + 작성자: ${{ steps.get_commit_info.outputs.author }} + + - name: Discord notification - Failure + if: steps.deploy.outcome == 'failure' + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_DEPLOY_WEBHOOK }} + DISCORD_USERNAME: GitHub + DISCORD_AVATAR: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png + uses: Ilshidur/action-discord@master + with: + args: | + ❌ 배포 중 오류가 발생했습니다. + 브랜치: develop + 커밋: ${{ steps.get_commit_info.outputs.message }} + 작성자: <@${{ steps.get_commit_info.outputs.author_username }}> + 실패한 워크플로우: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + + - name: Check deploy result + if: steps.deploy.outcome == 'failure' + run: exit 1 diff --git a/src/components/SideNav.tsx b/src/components/SideNav.tsx index ea8a786..a448c1f 100644 --- a/src/components/SideNav.tsx +++ b/src/components/SideNav.tsx @@ -52,7 +52,7 @@ export default function SideNav() { {/* Navigation Links */}