|
| 1 | +name: ci |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, dev] |
| 6 | + pull_request: |
| 7 | + branches: [main, dev] |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read # ์ฝ๋ ์ฝ๊ธฐ ๊ถํ |
| 11 | + pull-requests: write # ์๋๋ฆฌ๋ทฐ์ด ์ค์ ์ ์ํ ์ฐ๊ธฐ ๊ถํ |
| 12 | + |
| 13 | +jobs: |
| 14 | + build-and-deploy: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + # ์ ์ฅ์ ์ฝ๋ ๋ค์ด๋ก๋ |
| 18 | + - name: Checkout Code |
| 19 | + uses: actions/checkout@v5 |
| 20 | + # pnpm ์ค์น |
| 21 | + - name: Install pnpm |
| 22 | + uses: pnpm/action-setup@v4 |
| 23 | + with: |
| 24 | + version: 10 |
| 25 | + |
| 26 | + # pnpm store ์บ์ฑ |
| 27 | + - name: Get pnpm store directory |
| 28 | + id: pnpm-cache |
| 29 | + run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT |
| 30 | + |
| 31 | + - uses: actions/cache@v5 |
| 32 | + with: |
| 33 | + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} |
| 34 | + key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} |
| 35 | + restore-keys: ${{ runner.os }}-pnpm- |
| 36 | + |
| 37 | + # node.js ํ๊ฒฝ ์ค์ |
| 38 | + - name: Setup Node.js |
| 39 | + uses: actions/setup-node@v5 |
| 40 | + with: |
| 41 | + node-version: "24.x" |
| 42 | + # ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ค์น |
| 43 | + - name: Install dependencies |
| 44 | + run: pnpm install --frozen-lockfile |
| 45 | + # ํ๋ก์ ํธ ๋ฆฐํธ ๊ฒ์ฌ ๋ฐ ํ์
๊ฒ์ฌ |
| 46 | + - name: Check project |
| 47 | + id: check_step |
| 48 | + run: pnpm run lint && pnpm exec tsc --noEmit |
| 49 | + continue-on-error: true |
| 50 | + # ํ๋ก์ ํธ ๋น๋ |
| 51 | + - name: Build project |
| 52 | + id: build_step |
| 53 | + run: pnpm run build |
| 54 | + continue-on-error: true |
| 55 | + |
| 56 | + # ๋น๋ ๊ฒฐ๊ณผ |
| 57 | + - name: Output build result |
| 58 | + if: github.event_name == 'pull_request' && always() |
| 59 | + uses: marocchino/sticky-pull-request-comment@v2 |
| 60 | + with: |
| 61 | + header: build-result |
| 62 | + message: | |
| 63 | + ### ๐ ๋น๋ ๊ฒฐ๊ณผ |
| 64 | + ${{ steps.check_step.outcome == 'success' && 'โ
**๋ฆฐํธ ๊ฒ์ฌ ์๋ฃ**' || 'โ **๋ฆฐํธ ๊ฒ์ฌ ์คํจ**'}} |
| 65 | + ${{ steps.build_step.outcome == 'success' && 'โ
**๋น๋ ์ฑ๊ณต**' || 'โ **๋น๋ ์คํจ**' }} |
| 66 | +
|
| 67 | + <details> |
| 68 | + <summary>๋ก๊ทธ ํ์ธํ๊ธฐ</summary> |
| 69 | + <br> |
| 70 | + <a href="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"> |
| 71 | + Actions ํญ์์ ์์ธํ ๋ณด๊ธฐ |
| 72 | + </a> |
| 73 | + </details> |
| 74 | +
|
| 75 | + # ๋น๋ ๊ฒฐ๊ณผ ๋์ค์ฝ๋ ์๋ ๋ณด๋ด๊ธฐ |
| 76 | + - name: Notify Discord Alarm |
| 77 | + if: github.event_name == 'pull_request' && always() |
| 78 | + run: | |
| 79 | + PR_TITLE="${{ github.event.pull_request.title }}" |
| 80 | + PR_USER="${{ github.event.pull_request.user.login }}" |
| 81 | + PR_URL="${{ github.event.pull_request.html_url }}" |
| 82 | +
|
| 83 | + if [ "${{ steps.build_step.outcome }}" == "success" ]; then |
| 84 | + COLOR=3066993 |
| 85 | + TITLE="โ
๋น๋ ์ฑ๊ณต" |
| 86 | + else |
| 87 | + COLOR=15158332 |
| 88 | + TITLE="โ ๋น๋ ์คํจ" |
| 89 | + fi |
| 90 | +
|
| 91 | + DESCRIPTION="**๐ Title :** \`$PR_TITLE\`\n **๐ค์์ฑ์ :** \`$PR_USER\`\n\n**[๐ PR๋ณด๋ฌ๊ฐ๊ธฐ]($PR_URL)**" |
| 92 | + curl -H "Content-Type: application/json" \ |
| 93 | + -d "{ |
| 94 | + \"embeds\": [{ |
| 95 | + \"title\": \"$TITLE\", |
| 96 | + \"description\": \"$DESCRIPTION\", |
| 97 | + \"color\": $COLOR |
| 98 | + }] |
| 99 | + }" \ |
| 100 | + "${{ secrets.DISCORD_WEBHOOK_URL }}" |
| 101 | + # ๋น๋ ์คํจ ์, ์ข
๋ฃ |
| 102 | + - name: Check Build Status |
| 103 | + if: steps.check_step.outcome == 'failure' || steps.build_step.outcome == 'failure' |
| 104 | + run: exit 1 |
| 105 | + assign: |
| 106 | + runs-on: ubuntu-latest |
| 107 | + steps: |
| 108 | + - name: auto-assign-author-and-reviewer |
| 109 | + if: github.event_name == 'pull_request' && github.event.action == 'opened' |
| 110 | + uses: hkusu/review-assign-action@v1 |
| 111 | + with: |
| 112 | + assignees: ${{github.actor}} # ๋ด๋น์ ์ค์ |
| 113 | + reviewers: hummingbbird, odukong, u-zzn, qowjdals23 |
0 commit comments