-
Notifications
You must be signed in to change notification settings - Fork 1
[Init] CI/CD 파이프라인 구축 #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ec33ff5
init: ci.yml 파일 생성 (#3)
odukong 86d081b
init: cd.yml 파일 및 build.sh 파일 생성 (#3)
odukong 2e47d52
init: vercel.json 파일 추가 (#3)
odukong c6b74dd
fix: workflows 폴더명 수정 (#3)
odukong 339baa9
fix: 자동리뷰어 설정 문법 수정 (#3)
odukong 9892587
refactor: 린트 및 타입 검사결과와 무관하게 step 진행 (#3)
odukong 8635bf1
fix: 사용되지 않는 mustache 설치 코드 제거 (#3)
odukong f8304d1
refactor: commit-message를 head_commit 기준으로 변경 (#3)
odukong 7a72a4d
fix: vercel 배포 브랜치와 target-branch 동기화 (#3)
odukong 6dcc01e
fix: target_branch 수정 (#3)
odukong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| name: cd | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - name: creates output | ||
| run: sh ./build.sh | ||
| - name: Pushes to another repository | ||
| id: push_directory | ||
| uses: cpina/github-action-push-to-another-repository@main | ||
| env: | ||
| API_TOKEN_GITHUB: ${{ secrets.AUTO_ACTIONS }} | ||
| with: | ||
| source-directory: "output" | ||
| destination-github-username: odukong | ||
| destination-repository-name: COMFIT-CLIENT | ||
| user-email: ${{ secrets.EMAIL }} | ||
| commit-message: ${{ github.event.head_commit.message }} | ||
| target-branch: ${{ github.ref_name }} | ||
| - name: Test get variable exported by push-to-another-repository | ||
| run: echo $DESTINATION_CLONED_DIRECTORY |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| name: ci | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, dev] | ||
| pull_request: | ||
| branches: [main, dev] | ||
|
|
||
| permissions: | ||
| contents: read # 코드 읽기 권한 | ||
| pull-requests: write # 자동리뷰어 설정을 위한 쓰기 권한 | ||
|
|
||
| jobs: | ||
| build-and-deploy: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| # 저장소 코드 다운로드 | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v5 | ||
| # pnpm 설치 | ||
| - name: Install pnpm | ||
| uses: pnpm/action-setup@v4 | ||
| with: | ||
| version: 10 | ||
|
|
||
| # pnpm store 캐싱 | ||
| - name: Get pnpm store directory | ||
| id: pnpm-cache | ||
| run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | ||
|
|
||
| - uses: actions/cache@v5 | ||
| with: | ||
| path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | ||
| key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} | ||
| restore-keys: ${{ runner.os }}-pnpm- | ||
|
|
||
| # node.js 환경 설정 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v5 | ||
| with: | ||
| node-version: "24.x" | ||
| # 라이브러리 설치 | ||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
| # 프로젝트 린트 검사 및 타입 검사 | ||
| - name: Check project | ||
| id: check_step | ||
| run: pnpm run lint && pnpm exec tsc --noEmit | ||
| continue-on-error: true | ||
| # 프로젝트 빌드 | ||
| - name: Build project | ||
| id: build_step | ||
| run: pnpm run build | ||
| continue-on-error: true | ||
|
|
||
| # 빌드 결과 | ||
| - name: Output build result | ||
| if: github.event_name == 'pull_request' && always() | ||
| uses: marocchino/sticky-pull-request-comment@v2 | ||
| with: | ||
| header: build-result | ||
| message: | | ||
| ### 🚀 빌드 결과 | ||
| ${{ steps.check_step.outcome == 'success' && '✅ **린트 검사 완료**' || '❌ **린트 검사 실패**'}} | ||
| ${{ steps.build_step.outcome == 'success' && '✅ **빌드 성공**' || '❌ **빌드 실패**' }} | ||
|
|
||
| <details> | ||
| <summary>로그 확인하기</summary> | ||
| <br> | ||
| <a href="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"> | ||
| Actions 탭에서 자세히 보기 | ||
| </a> | ||
| </details> | ||
|
|
||
| # 빌드 결과 디스코드 알람 보내기 | ||
| - name: Notify Discord Alarm | ||
| if: github.event_name == 'pull_request' && always() | ||
| run: | | ||
| PR_TITLE="${{ github.event.pull_request.title }}" | ||
| PR_USER="${{ github.event.pull_request.user.login }}" | ||
| PR_URL="${{ github.event.pull_request.html_url }}" | ||
|
|
||
| if [ "${{ steps.build_step.outcome }}" == "success" ]; then | ||
| COLOR=3066993 | ||
| TITLE="✅ 빌드 성공" | ||
| else | ||
| COLOR=15158332 | ||
| TITLE="❌ 빌드 실패" | ||
| fi | ||
|
|
||
| DESCRIPTION="**🚀 Title :** \`$PR_TITLE\`\n **👤작성자 :** \`$PR_USER\`\n\n**[🔎 PR보러가기]($PR_URL)**" | ||
| curl -H "Content-Type: application/json" \ | ||
| -d "{ | ||
| \"embeds\": [{ | ||
| \"title\": \"$TITLE\", | ||
| \"description\": \"$DESCRIPTION\", | ||
| \"color\": $COLOR | ||
| }] | ||
| }" \ | ||
| "${{ secrets.DISCORD_WEBHOOK_URL }}" | ||
| # 빌드 실패 시, 종료 | ||
| - name: Check Build Status | ||
| if: steps.check_step.outcome == 'failure' || steps.build_step.outcome == 'failure' | ||
| run: exit 1 | ||
| assign: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: auto-assign-author-and-reviewer | ||
| if: github.event_name == 'pull_request'&&github.event.action=='opened' | ||
| uses: hkusu/review-assign-action@v1 | ||
| with: | ||
| assignees: ${{github.actor}} # 담당자 설정 | ||
| reviewers: hummingbbird, odukong, u-zzn, qowjdals23 | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #!/bin/sh | ||
| cd ../ | ||
| mkdir output | ||
| cp -R ./COMFIT-CLIENT/* ./output | ||
| cp -R ./output ./COMFIT-CLIENT/ |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. vercel 배포에 필요한 설정도 같이 해주는 꼼꼼함 .. 최고다오두콩
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 칭찬에 덩실덩실대는 오두콩이되.... |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "rewrites": [ | ||
| { | ||
| "source": "/(.*)", | ||
| "destination": "/index.html" | ||
| } | ||
| ] | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제가 ci/cd에 대해 잘 몰라서 한 번 찾아봤는데,
Check project(lint/tsc)단계에서 실패가 발생하면 기본 동작상 job이 이 지점에서 종료될 수 있어서 뒤에 있는 PR 결과 코멘트나 Discord 알림 스텝이 실행되지 않는 경우가 생길 수도 있다고 합니다ㅠ!!PR 코멘트 / Discord 스텝에
always()조건이 있긴 하지만, job 자체가 중간에 종료되면 해당 스텝까지 아예 도달하지 못하는 케이스가 있을 수도 있다고 하네요 🥲그래서
check_step에도continue-on-error를 두고, 마지막에 lint / tsc / build 결과(outcome)를 종합해서 exit 처리하도록 하면 좋을 것 같은데 이 방향에 대해서는 어떻게 생각하시는지 궁금합니다! 🤔There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lint 검사 단계에 실패한 경우에는 비교적 무거운 build단계를 실행하지 않고, 바로 comment 스탭으로 넘어가기 위해
continue-on-error옵션을 작성해두지 않았는데, 검사 실패로 인한 comment 스탭에 아예 도달하지 못하는 경우도 고려해서 lint 검사 단계에서도continue-on-error옵션을 적용하도록 하겠습니다 구욷 ( ̄︶ ̄*))