vercel에 팀 프로젝트를 무료로 운영하는 방법은 정말 간단합니다..

  1. GitHub에 팀 공식 계정 만들고 퍼블릭 Repository 생성
  2. Vercel에 personal plan으로 연동
  3. GitHub Organization에서 운영하고 있는 Repository에 GitHub Actions 이벤트 걸기
  4. yml 파일 내부에서 공식 계정 Repository에 push하기

즉, GitHub Actions에서 올려주는 가상머신을 프록시로 사용하여 개인 계정으로 소스코드를 배포하는 겁니다.

2번까지의 과정은 간단하니 스킵하고, 3번부터 간략하게 설명드리겠습니다.

먼저 새로 만드신 공식 계정에 로그인 하신 후, https://github.com/settings/tokens 에 접속하여 secret 토큰을 하나 만들어줍니다. 권한은 repo 쪽 권한을 주시면 됩니다.

그럼 이제 GitHub Organization에 있는 Repository의 Secrets 탭에 들어가서 새로 만든 계정의 이메일과 아까 만들었던 토큰을 시크릿 변수로 등록해줍니다.

GitHub Organization에서 운영되고 있는 Repository 루트 경로에 [build.sh](<http://build.sh>) 파일을 생성합니다.

// build.sh 파일

#!/bin/sh
cd ../
mkdir output
cp -R ./[your-repository-name]/* ./output
cp -R ./output ./[your-repository-name]/

그 후에 GitHub Actions를 활성화 해주시고, .github/workflows/git-push.yml 파일을 생성합니다.

name: git push into another repo to deploy to vercel

on:
  push:
    branches: [main]

jobs:
  build:
    runs-on: ubuntu-latest
    container: pandoc/latex
    steps:
      - uses: actions/checkout@v2
      - name: Install mustache (to update the date)
        run: apk add ruby && gem install mustache
      - 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.API_TOKEN_GITHUB }}
        with:
          source-directory: 'output'
          destination-github-username: [your-team-official-github-name]
          destination-repository-name: [your-team-official-github-repository-name]
          user-email: ${{ secrets.OFFICIAL_ACCOUNT_EMAIL }}
          commit-message: ${{ github.event.commits[0].message }}
          target-branch: main
      - name: Test get variable exported by push-to-another-repository
        run: echo $DESTINATION_CLONED_DIRECTORY