Merge pull request #236 from SOPT-36-NINEDOT/fix/#235/sprint2-qa #568
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: CI | |
| on: | |
| pull_request: | |
| branches: [develop, main] | |
| push: | |
| branches: [develop, main] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| build: | |
| if: github.event_name == 'pull_request' || | |
| (github.event_name == 'push' && !contains(github.event.head_commit.message, '[skip ci]')) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| cache-dependency-path: 'pnpm-lock.yaml' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run Lint | |
| run: pnpm lint | |
| - name: Build project with Vite | |
| id: build | |
| run: pnpm build | |
| continue-on-error: true | |
| - name: Evaluate build status | |
| id: status | |
| run: | | |
| result="failed" | |
| message="빌드 실패 😵" | |
| if [ "${{ steps.build.outcome }}" == "success" ]; then | |
| result="success" | |
| message="빌드 성공 🎉" | |
| fi | |
| echo "result=$result" >> $GITHUB_OUTPUT | |
| echo "message=$message" >> $GITHUB_OUTPUT | |
| - name: Add comment to PR with build status | |
| if: github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const prNumber = context.payload.pull_request.number; | |
| const message = `${{ steps.status.outputs.message }}`; | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: prNumber, | |
| body: `### 빌드 결과\n${message}` | |
| }); | |
| - name: Upload build artifacts | |
| if: steps.build.outcome == 'success' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-files-${{ github.sha }} | |
| path: dist/ | |
| retention-days: 3 | |
| - name: Fail job if build failed | |
| if: steps.build.outcome == 'failure' | |
| run: exit 1 |