From 4232c80f2f6a93fc832d5a1bc79c1d8ec3dac5e5 Mon Sep 17 00:00:00 2001 From: tolelom <98kimsungmin@naver.com> Date: Thu, 19 Mar 2026 16:40:30 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20CI=EB=A5=BC=20Gitea=20runner=20=ED=98=B8?= =?UTF-8?q?=ED=99=98=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20=E2=80=94=20?= =?UTF-8?q?GitHub=20Action=20=EC=9D=98=EC=A1=B4=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit actions/setup-node → curl + apt-get 직접 설치 docker/login-action + build-push-action → docker CLI 직접 사용 appleboy/ssh-action → ssh 직접 실행 Gitea runner가 github.com에서 action clone 실패하는 문제 해결. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/ci.yml | 56 ++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa68a19..951bea9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,10 +13,13 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: '22' - cache: 'npm' + - name: Setup Node.js + run: | + if ! command -v node &>/dev/null || [ "$(node -v | cut -d. -f1 | tr -d v)" -lt 22 ]; then + curl -fsSL https://deb.nodesource.com/setup_22.x | bash - + apt-get install -y nodejs + fi + node -v && npm -v - name: Install dependencies run: npm ci --legacy-peer-deps @@ -40,37 +43,28 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: docker/setup-buildx-action@v3 + - name: Login to Gitea Registry + run: echo "${{ secrets.GITEA_TOKEN }}" | docker login git.tolelom.xyz -u "${{ github.actor }}" --password-stdin - - uses: docker/login-action@v3 - with: - registry: git.tolelom.xyz - username: ${{ github.actor }} - password: ${{ secrets.GITEA_TOKEN }} - - - uses: docker/build-push-action@v5 - with: - context: . - push: true - tags: git.tolelom.xyz/${{ github.repository_owner }}/a301-web:latest - platforms: linux/arm64 - build-args: | - VITE_API_BASE_URL=https://a301.api.tolelom.xyz - cache-from: type=gha - cache-to: type=gha,mode=max + - name: Build and Push Docker Image + run: | + docker build \ + --build-arg VITE_API_BASE_URL=https://a301.api.tolelom.xyz \ + -t git.tolelom.xyz/${{ github.repository_owner }}/a301-web:latest \ + . + docker push git.tolelom.xyz/${{ github.repository_owner }}/a301-web:latest # ── 3. 서버 배포 ────────────────────────────────────────────────────────── deploy: needs: docker runs-on: ubuntu-latest steps: - - uses: appleboy/ssh-action@v1 - with: - host: ${{ secrets.SERVER_HOST }} - username: ${{ secrets.SERVER_USER }} - key: ${{ secrets.SSH_PRIVATE_KEY }} - script: | - export PATH=$PATH:/usr/local/bin:/opt/homebrew/bin:$HOME/.docker/bin - cd ~/server - docker compose pull web - docker compose up -d web + - name: Deploy to Server + run: | + mkdir -p ~/.ssh + echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/deploy_key + chmod 600 ~/.ssh/deploy_key + ssh -o StrictHostKeyChecking=no -i ~/.ssh/deploy_key \ + ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }} \ + 'export PATH=$PATH:/usr/local/bin:/opt/homebrew/bin:$HOME/.docker/bin && cd ~/server && docker compose pull web && docker compose up -d web' + rm -f ~/.ssh/deploy_key