조직(Organization) 저장소에서 Vercel을 사용하려고 했는데, 유료 플랜이 필요해서 개인 계정에 포크(Fork) 해서 배포하는 상황!
하지만, 포크된 저장소는 계속 업데이트해야 하는 번거로움이 있음 😩
➡ ✅ 해결법: GitHub Actions를 활용하여 매일 자동으로 포크를 최신 상태로 유지하고, Vercel에서 자동 배포되도록 설정!
🔍 문제: Vercel이 Organization 저장소에서 무료 배포를 지원하지 않음
✅ 이유:
➡ 해결법:
💡 포크한 저장소를 최신 상태로 유지하려면 매일 원본 저장소(Upstream)에서 자동으로 동기화해야 함!
✅ GitHub Actions을 사용하여 매일 자동으로 최신 코드 동기화!
Songyeonji/SnapSum-frontend
)에서organization/SnapSum-frontend
)의 변경 사항을 가져와 병합.github/workflows/sync-fork.yml
)📌 이 스크립트를 개인 저장소(Songyeonji/SnapSum-frontend
)에 추가하면 매일 자동으로 최신 상태 유지됨!
yaml
복사편집
name: Sync Fork with Upstream
on:
schedule:
- cron: '0 0 * * *' # 매일 자정(UTC 기준) 자동 실행
workflow_dispatch: # 필요하면 수동 실행도 가능
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Configure Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
- name: Add upstream repository
run: git remote add upstream https://github.com/organization/SnapSum-frontend.git
- name: Fetch upstream changes
run: git fetch upstream
- name: Merge upstream changes into main
run: |
git checkout main
git merge upstream/main --allow-unrelated-histories || true
- name: Push changes to forked repository
run: git push origin main
1️⃣ 포크한 저장소(Songyeonji/SnapSum-frontend
)에서 .github/workflows/sync-fork.yml
파일 생성
2️⃣ 위 YAML 코드를 파일에 추가하고 저장
3️⃣ GitHub에서 Actions 탭 → Enable Workflows
클릭하여 활성화
4️⃣ 매일 자동으로 업데이트됨! 🚀
💡 포크된 저장소에서 최신 코드가 업데이트되면 Vercel이 자동으로 배포해야 함!
Vercel → Project Settings
→ Git
설정 확인
GitHub Actions 실행 후 Vercel이 자동으로 배포되는지 확인
자동 배포 안 되면 Vercel 대시보드에서 "Redeploy"
버튼 클릭
GitHub에 빈 커밋 푸시하여 강제로 트리거 가능
sh
복사편집
git commit --allow-empty -m "Trigger Vercel Deploy"
git push origin main
.github/workflows/sync-fork.yml
) 사용cron
스케줄링으로 Upstream 최신 코드 가져오기Redeploy
실행✔ Vercel 무료 플랜 유지하면서 최신 코드 자동 업데이트!
✔ GitHub 포크 자동 동기화 → Vercel 자동 배포까지 완벽 자동화!