Fix: CI를 Gitea runner 호환으로 변경 — GitHub Action 의존 제거
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) <noreply@anthropic.com>
This commit is contained in:
56
.github/workflows/ci.yml
vendored
56
.github/workflows/ci.yml
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user